Merge lp:~akopytov/percona-xtrabackup/bug925441 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 405
Proposed branch: lp:~akopytov/percona-xtrabackup/bug925441
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 63 lines (+13/-5)
1 file modified
src/xtrabackup.c (+13/-5)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug925441
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+98817@code.launchpad.net

Description of the change

  The problem was that posix_fadvise(POSIX_FADV_DONTNEED) was used
  incorrectly, because the call just releases already cached pages from
  the pagecache, thus making a single-shot call before file access
  useless.

  Fixed by making sure the call is invoked after each read/write to
  make the feature work as advertised.

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :
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
=== modified file 'src/xtrabackup.c'
--- src/xtrabackup.c 2012-02-20 04:38:44 +0000
+++ src/xtrabackup.c 2012-03-22 11:21:18 +0000
@@ -3125,7 +3125,6 @@
31253125
3126#ifdef USE_POSIX_FADVISE3126#ifdef USE_POSIX_FADVISE
3127 posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);3127 posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
3128 posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED);
3129#endif3128#endif
31303129
3131 if (my_stat(node->name, &src_stat, MYF(MY_WME)) == NULL) {3130 if (my_stat(node->name, &src_stat, MYF(MY_WME)) == NULL) {
@@ -3188,6 +3187,10 @@
3188 goto error;3187 goto error;
3189 }3188 }
31903189
3190#ifdef USE_POSIX_FADVISE
3191 posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED);
3192#endif
3193
3191 /* check corruption and retry */3194 /* check corruption and retry */
3192 for (chunk_offset = 0; chunk_offset < chunk; chunk_offset += page_size) {3195 for (chunk_offset = 0; chunk_offset < chunk; chunk_offset += page_size) {
3193#ifndef INNODB_VERSION_SHORT3196#ifndef INNODB_VERSION_SHORT
@@ -3538,6 +3541,12 @@
3538 rc = my_write(dst_log_fd, log_sys->buf, write_size,3541 rc = my_write(dst_log_fd, log_sys->buf, write_size,
3539 MYF(MY_WME | MY_NABP));3542 MYF(MY_WME | MY_NABP));
35403543
3544#ifdef USE_POSIX_FADVISE
3545 if (!xtrabackup_log_only) {
3546 posix_fadvise(dst_log_fd, 0, 0, POSIX_FADV_DONTNEED);
3547 }
3548#endif
3549
3541 if(rc) {3550 if(rc) {
3542 msg("xtrabackup: Error: write to logfile failed\n");3551 msg("xtrabackup: Error: write to logfile failed\n");
3543 goto error;3552 goto error;
@@ -3792,7 +3801,6 @@
37923801
3793#ifdef USE_POSIX_FADVISE3802#ifdef USE_POSIX_FADVISE
3794 posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);3803 posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
3795 posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED);
3796#endif3804#endif
37973805
3798 if (my_seek(src_file, 0, SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR) {3806 if (my_seek(src_file, 0, SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR) {
@@ -3816,6 +3824,9 @@
3816 buf = (uchar *) ut_malloc(buf_size);3824 buf = (uchar *) ut_malloc(buf_size);
38173825
3818 while ((bytes = my_read(src_file, buf, buf_size, MYF(MY_WME))) > 0) {3826 while ((bytes = my_read(src_file, buf, buf_size, MYF(MY_WME))) > 0) {
3827#ifdef USE_POSIX_FADVISE
3828 posix_fadvise(src_file, 0, 0, POSIX_FADV_DONTNEED);
3829#endif
3819 if (ds->write(dst_file, buf, bytes)) {3830 if (ds->write(dst_file, buf, bytes)) {
3820 msg("xtrabackup: error: cannot write to stream "3831 msg("xtrabackup: error: cannot write to stream "
3821 "for %s.\n", XB_LOG_FILENAME);3832 "for %s.\n", XB_LOG_FILENAME);
@@ -4228,9 +4239,6 @@
4228 exit(EXIT_FAILURE);4239 exit(EXIT_FAILURE);
4229 }4240 }
4230 }4241 }
4231#ifdef USE_POSIX_FADVISE
4232 posix_fadvise(dst_log_fd, 0, 0, POSIX_FADV_DONTNEED);
4233#endif
4234 } else {4242 } else {
4235 dst_log_fd = dup(fileno(stdout));4243 dst_log_fd = dup(fileno(stdout));
4236 if (dst_log_fd < 0) {4244 if (dst_log_fd < 0) {

Subscribers

People subscribed via source and target branches