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

Proposed by Alexey Kopytov
Status: Merged
Approved by: Sergei Glushchenko
Approved revision: no longer in the source branch.
Merged at revision: 508
Proposed branch: lp:~akopytov/percona-xtrabackup/bug870119-2.0
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 71 lines (+34/-20)
2 files modified
src/xtrabackup.cc (+16/-20)
test/t/bug870119.sh (+18/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug870119-2.0
Reviewer Review Type Date Requested Status
Sergei Glushchenko (community) g2 Approve
Review via email: mp+151867@code.launchpad.net

Description of the change

Bug #870119: assertion failure while trying to read InnoDB partition

The problem was that the InnoDB file I/O subsystem may reuse file
descriptors by closing the old ones when the number of open files hits
innodb_open_files. Which works for InnoDB, because if InnoDB needs to
access a table which has been closed, it would just reopen it.However,
that didn't work for XtraBackup, since it only keeps a file descriptor
when copying a file. So when the --parallel option was used, there was a
chance that another thread wanted to open a file and hit
innodb_open_files. Therefore fil_try_to_close_file_in_LRU() might close
the file descriptor which was currently in use by another thread and
then this descriptor is shortly reused when opening another file. Which
would result in obscure failures like this.

However, most part of the problem disappeared with the fix for bug
#713267
: XtraBackup no longer relies on the file descriptors created by
the 'fil' subsystem of InnoDB to get tablespace flags, and that was the
reason for exhausting the innodb_open_files pool. So bug #870119 is
essentially a duplicate, or at least became extremely hard to hit in the
wild.

The only thing that should be done to exclude even a theoretical chance
of reusing file descriptors from the 'fil' subsystem is to always create
a new file descriptor to copy the file, instead of checking if a node
has been previously open by the 'fil' subsystem and reusing the
descriptor if so. Which is what this fix implements.

http://jenkins.percona.com/view/XtraBackup/job/percona-xtrabackup-2.0-param/353/

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

I saw similar issue couple of times and was pretty much surprised why we reusing descriptors from fil_system. I even filed a bug https://bugs.launchpad.net/percona-xtrabackup/+bug/1059151. Marking it as duplicate of bug 870119 since it has been fixed.

Approve.

review: Approve (g2)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/xtrabackup.cc'
2--- src/xtrabackup.cc 2013-03-01 06:54:51 +0000
3+++ src/xtrabackup.cc 2013-03-06 04:51:20 +0000
4@@ -3334,28 +3334,24 @@
5 }
6
7 /* open src_file*/
8- if (!node->open) {
9- src_file = xb_file_create_no_error_handling(node->name,
10- OS_FILE_OPEN,
11- OS_FILE_READ_ONLY,
12- &success);
13- if (!success) {
14- /* The following call prints an error message */
15- os_file_get_last_error(TRUE);
16-
17- msg("[%02u] xtrabackup: Warning: cannot open %s\n"
18- "[%02u] xtrabackup: Warning: We assume the "
19- "table was dropped or renamed during "
20- "xtrabackup execution and ignore the file.\n",
21- thread_n, node->name, thread_n);
22- goto skip;
23- }
24-
25- xb_file_set_nocache(src_file, node->name, "OPEN");
26- } else {
27- src_file = node->handle;
28+ src_file = xb_file_create_no_error_handling(node->name,
29+ OS_FILE_OPEN,
30+ OS_FILE_READ_ONLY,
31+ &success);
32+ if (!success) {
33+ /* The following call prints an error message */
34+ os_file_get_last_error(TRUE);
35+
36+ msg("[%02u] xtrabackup: Warning: cannot open %s\n"
37+ "[%02u] xtrabackup: Warning: We assume the "
38+ "table was dropped or renamed during "
39+ "xtrabackup execution and ignore the file.\n",
40+ thread_n, node->name, thread_n);
41+ goto skip;
42 }
43
44+ xb_file_set_nocache(src_file, node->name, "OPEN");
45+
46 #ifdef USE_POSIX_FADVISE
47 posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
48 #endif
49
50=== added file 'test/t/bug870119.sh'
51--- test/t/bug870119.sh 1970-01-01 00:00:00 +0000
52+++ test/t/bug870119.sh 2013-03-06 04:51:20 +0000
53@@ -0,0 +1,18 @@
54+########################################################################
55+# Bug #870119: assertion failure while trying to read InnoDB partition
56+########################################################################
57+
58+. inc/common.sh
59+
60+start_server --innodb_file_per_table
61+
62+# Set the minimum value for innodb_open_files to be used by xtrabackup
63+echo "innodb_open_files=10" >>$topdir/my.cnf
64+
65+load_dbase_schema sakila
66+load_dbase_data sakila
67+
68+innobackupex --no-timestamp $topdir/backup --parallel=16
69+
70+# No need to prepare and verify the backup, as the bug was resulting in a fatal
71+# error during the backup

Subscribers

People subscribed via source and target branches