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

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Sergei Glushchenko
Approved revision: no longer in the source branch.
Merged at revision: 643
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1286114-5.5
Merge into: lp:percona-server/5.5
Diff against target: 34 lines (+16/-6)
1 file modified
storage/innobase/fil/fil0fil.c (+16/-6)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1286114-5.5
Reviewer Review Type Date Requested Status
Sergei Glushchenko (community) g2 Approve
Review via email: mp+209620@code.launchpad.net

Description of the change

    Fix bug 1286114 (Slow file extend when innodb_use_fallocate=1 and SSD
    file storage) based on the patch by Jan Lindström.

    Replace the posix_fallocate zero to desired extent-calling
    os_file_set_size call in fil_extend_space_to_desired_size with a local
    posix_fallocate call that extends starting from the current end of
    file only.

http://jenkins.percona.com/job/percona-server-5.5-param/966/
Also run MTR locally with enabled srv_use_fallocate.

To post a comment you must log in.
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Approve

review: Approve (g2)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storage/innobase/fil/fil0fil.c'
2--- storage/innobase/fil/fil0fil.c 2013-12-05 08:07:26 +0000
3+++ storage/innobase/fil/fil0fil.c 2014-03-06 09:27:53 +0000
4@@ -4953,14 +4953,24 @@
5
6 #ifdef HAVE_POSIX_FALLOCATE
7 if (srv_use_posix_fallocate) {
8- offset_high = (size_after_extend - file_start_page_no)
9- * page_size / (4ULL * 1024 * 1024 * 1024);
10- offset_low = (size_after_extend - file_start_page_no)
11- * page_size % (4ULL * 1024 * 1024 * 1024);
12+
13+ ib_int64_t start_offset
14+ = file_start_page_no * page_size;
15+ ib_int64_t end_offset
16+ = (size_after_extend - file_start_page_no) * page_size;
17
18 mutex_exit(&fil_system->mutex);
19- success = os_file_set_size(node->name, node->handle,
20- offset_low, offset_high);
21+ success = (posix_fallocate(node->handle, start_offset,
22+ end_offset) == 0);
23+ if (!success)
24+ {
25+ fprintf(stderr,
26+ "InnoDB: Error: preallocating file space for "
27+ "file \'%s\' failed. Current size %lld, "
28+ "len %lld, desired size %lld\n", node->name,
29+ start_offset, end_offset,
30+ start_offset + end_offset);
31+ }
32 mutex_enter(&fil_system->mutex);
33 if (success) {
34 node->size += (size_after_extend - start_page_no);

Subscribers

People subscribed via source and target branches