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
=== 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:10:36 +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
=== modified file 'Percona-Server/mysql-test/suite/innodb/r/innodb_wl6347_comp_indx_stat.result'
--- Percona-Server/mysql-test/suite/innodb/r/innodb_wl6347_comp_indx_stat.result 2013-05-12 06:24:46 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/innodb_wl6347_comp_indx_stat.result 2013-05-30 15:10:36 +0000
@@ -979,7 +979,7 @@
979AND table_name='tab5' AND database_name='test'979AND table_name='tab5' AND database_name='test'
980AND index_name like 'idx%' ;980AND index_name like 'idx%' ;
981compress_stat 1981compress_stat 1
982The size of the tab5.ibd file: 2097152982The size of the tab5.ibd file: 163840
983# fetch the compressed page and check the stats983# fetch the compressed page and check the stats
984===============984===============
985Fetch Records985Fetch Records
@@ -1005,7 +1005,7 @@
1005AND table_name='tab5' AND database_name='test'1005AND table_name='tab5' AND database_name='test'
1006AND index_name like 'idx%' ;1006AND index_name like 'idx%' ;
1007compress_stat 11007compress_stat 1
1008The size of the tab5.ibd file: 20971521008The size of the tab5.ibd file: 163840
1009# fetch the compressed same page once again and check the stats1009# fetch the compressed same page once again and check the stats
1010# the stat figures should be same as above query1010# the stat figures should be same as above query
1011===============1011===============
@@ -1032,7 +1032,7 @@
1032AND table_name='tab5' AND database_name='test'1032AND table_name='tab5' AND database_name='test'
1033AND index_name like 'idx%' ;1033AND index_name like 'idx%' ;
1034compress_stat 11034compress_stat 1
1035The size of the tab5.ibd file: 20971521035The size of the tab5.ibd file: 163840
1036DROP TABLE tab5;1036DROP TABLE tab5;
1037#reset the stat table before starting next testcase1037#reset the stat table before starting next testcase
1038SET GLOBAL innodb_cmp_per_index_enabled=0;1038SET GLOBAL innodb_cmp_per_index_enabled=0;
10391039
=== 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:10:36 +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:10:36 +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.cc'
--- Percona-Server/storage/innobase/fsp/fsp0fsp.cc 2013-05-13 04:25:56 +0000
+++ Percona-Server/storage/innobase/fsp/fsp0fsp.cc 2013-05-30 15:10:36 +0000
@@ -2686,14 +2686,14 @@
2686 fsp_header_t* space_header, /*!< in: header of that space,2686 fsp_header_t* space_header, /*!< in: header of that space,
2687 x-latched */2687 x-latched */
2688 ulint size, /*!< in: size of the tablespace in2688 ulint size, /*!< in: size of the tablespace in
2689 pages, must be < FSP_EXTENT_SIZE/2 */2689 pages, must be < FSP_EXTENT_SIZE */
2690 mtr_t* mtr) /*!< in/out: mini-transaction */2690 mtr_t* mtr) /*!< in/out: mini-transaction */
2691{2691{
2692 xdes_t* descr;2692 xdes_t* descr;
2693 ulint n_used;2693 ulint n_used;
26942694
2695 ut_a(space != 0);2695 ut_a(space != 0);
2696 ut_a(size < FSP_EXTENT_SIZE / 2);2696 ut_a(size < FSP_EXTENT_SIZE);
26972697
2698 descr = xdes_get_descriptor_with_space_hdr(space_header, space, 0,2698 descr = xdes_get_descriptor_with_space_hdr(space_header, space, 0,
2699 mtr);2699 mtr);
@@ -2773,7 +2773,7 @@
2773try_again:2773try_again:
2774 size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, mtr);2774 size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, mtr);
27752775
2776 if (size < FSP_EXTENT_SIZE / 2) {2776 if (size < FSP_EXTENT_SIZE) {
2777 /* Use different rules for small single-table tablespaces */2777 /* Use different rules for small single-table tablespaces */
2778 *n_reserved = 0;2778 *n_reserved = 0;
2779 return(fsp_reserve_free_pages(space, space_header, size, mtr));2779 return(fsp_reserve_free_pages(space, space_header, size, mtr));
@@ -2787,11 +2787,9 @@
2787 /* Below we play safe when counting free extents above the free limit:2787 /* Below we play safe when counting free extents above the free limit:
2788 some of them will contain extent descriptor pages, and therefore2788 some of them will contain extent descriptor pages, and therefore
2789 will not be free extents */2789 will not be free extents */
2790 if (size <= free_limit) {2790
2791 n_free_up = 0;2791 ut_ad(size >= free_limit);
2792 } else {2792 n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
2793 n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
2794 }
27952793
2796 if (n_free_up > 0) {2794 if (n_free_up > 0) {
2797 n_free_up--;2795 n_free_up--;

Subscribers

People subscribed via source and target branches