Merge lp:~akopytov/percona-xtrabackup/bug408803-1.7 into lp:percona-xtrabackup/2.0

Proposed by Alexey Kopytov
Status: Merged
Merged at revision: 330
Proposed branch: lp:~akopytov/percona-xtrabackup/bug408803-1.7
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 282 lines (+81/-60)
5 files modified
doc/source/innobackupex/how_innobackupex_works.rst (+1/-1)
doc/source/innobackupex/privileges.rst (+1/-1)
innobackupex (+61/-54)
test/t/bug884737.sh (+14/-0)
xtrabackup.c (+4/-4)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug408803-1.7
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+82103@code.launchpad.net
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 'doc/source/innobackupex/how_innobackupex_works.rst'
--- doc/source/innobackupex/how_innobackupex_works.rst 2011-10-21 17:47:31 +0000
+++ doc/source/innobackupex/how_innobackupex_works.rst 2011-11-14 07:14:52 +0000
@@ -59,7 +59,7 @@
5959
60Finally, the binary log position will be printed to ``STDERR`` and |innobackupex| will exit returning 0 if all went OK.60Finally, the binary log position will be printed to ``STDERR`` and |innobackupex| will exit returning 0 if all went OK.
6161
62Note that the ``STDERR`` of |innobackupex| is not written in any file. You will have to redirect it to a file, e.g., ``innobackupex OPTIONS > backupout.log``.62Note that the ``STDERR`` of |innobackupex| is not written in any file. You will have to redirect it to a file, e.g., ``innobackupex OPTIONS 2> backupout.log``.
6363
64.. _copy-back-ibk:64.. _copy-back-ibk:
6565
6666
=== modified file 'doc/source/innobackupex/privileges.rst'
--- doc/source/innobackupex/privileges.rst 2011-07-28 05:29:04 +0000
+++ doc/source/innobackupex/privileges.rst 2011-11-14 07:14:52 +0000
@@ -8,7 +8,7 @@
88
9Permissions are those which permits a user to perform operations on the system, like reading, writing or executing on a certain directory or start/stop a system service. **They are set at a system level and only apply to system users**.9Permissions are those which permits a user to perform operations on the system, like reading, writing or executing on a certain directory or start/stop a system service. **They are set at a system level and only apply to system users**.
1010
11Whether |xtrabackup| or |innobackupex| is used, there are two actors involved: the user invoking the program - *a system user* - and the user performing action in the database server - *a database server*. Note that these are different users on different places, despite they may have the same username.11Whether |xtrabackup| or |innobackupex| is used, there are two actors involved: the user invoking the program - *a system user* - and the user performing action in the database server - *a database user*. Note that these are different users on different places, despite they may have the same username.
1212
13All the invocations of |innobackupex| and |xtrabackup| in this documentation assumes that the system user has the appropriate permissions and you are providing the relevant options for connecting the database server - besides the options for the action to be performed - and the database user has adequate privileges. 13All the invocations of |innobackupex| and |xtrabackup| in this documentation assumes that the system user has the appropriate permissions and you are providing the relevant options for connecting the database server - besides the options for the action to be performed - and the database user has adequate privileges.
1414
1515
=== modified file 'innobackupex'
--- innobackupex 2011-10-21 17:47:31 +0000
+++ innobackupex 2011-11-14 07:14:52 +0000
@@ -54,7 +54,7 @@
5454
55# time in seconds after which a dummy query is sent to mysql server55# time in seconds after which a dummy query is sent to mysql server
56# in order to keep the database connection alive56# in order to keep the database connection alive
57my $mysql_keep_alive_timeout = 1800;57my $mysql_keep_alive = 5;
5858
59######################################################################59######################################################################
60# end of modifiable parameters60# end of modifiable parameters
@@ -169,9 +169,6 @@
169# run on a slave server169# run on a slave server
170my $mysql_slave_position = '';170my $mysql_slave_position = '';
171171
172# time of the most recent mysql_check call. (value returned by time() function)
173my $mysql_last_access_time = 0;
174
175# process id of ibbackup program (runs as a child process of this script)172# process id of ibbackup program (runs as a child process of this script)
176my $ibbackup_pid = '';173my $ibbackup_pid = '';
177174
@@ -366,7 +363,6 @@
366 # check that we can connect to the database. This done by363 # check that we can connect to the database. This done by
367 # connecting, issuing a query, and closing the connection.364 # connecting, issuing a query, and closing the connection.
368 mysql_open();365 mysql_open();
369 mysql_check();
370 mysql_close();366 mysql_close();
371367
372 # start ibbackup as a child process368 # start ibbackup as a child process
@@ -379,19 +375,15 @@
379375
380 # connect to database376 # connect to database
381 mysql_open();377 mysql_open();
382 mysql_check();
383378
384 if ($option_safe_slave_backup) {379 if ($option_safe_slave_backup) {
385 mysql_check();
386 wait_for_safe_slave();380 wait_for_safe_slave();
387 }381 }
388382
389 # flush tables with read lock383 # flush tables with read lock
390 mysql_check();
391 mysql_lockall() if !$option_no_lock;384 mysql_lockall() if !$option_no_lock;
392385
393 if ($option_slave_info) {386 if ($option_slave_info) {
394 mysql_check();
395 write_slave_info();387 write_slave_info();
396 }388 }
397389
@@ -406,7 +398,6 @@
406 mysql_unlockall() if !$option_no_lock;398 mysql_unlockall() if !$option_no_lock;
407399
408 if ( $option_safe_slave_backup && $host_is_slave ) {400 if ( $option_safe_slave_backup && $host_is_slave ) {
409 mysql_check();
410 print STDERR "$prefix: Starting slave SQL thread\n";401 print STDERR "$prefix: Starting slave SQL thread\n";
411 mysql_send('START SLAVE SQL_THREAD;');402 mysql_send('START SLAVE SQL_THREAD;');
412 }403 }
@@ -991,35 +982,15 @@
991982
992983
993#984#
994# mysql_open subroutine starts mysql as a child process with985# Check that the server is responding to queries
995# a pipe connection.986#
996#987sub mysql_ping {
997sub mysql_open {
998 my $options = get_mysql_options();
999 # run mysql as a child process with a pipe connection
1000 $now = current_time();
1001 (my $prt_options = $options) =~ s/--password=[^ ]+ /--password=xxxxxxxx /g;
1002 print STDERR "$now $prefix Starting mysql with options: $prt_options\n";
1003 $mysql_pid = open(*MYSQL_WRITER, "| mysql $options >$mysql_stdout 2>$mysql_stderr ") or Die "Failed to spawn mysql child process: $!";
1004 MYSQL_WRITER->autoflush(1);
1005 $now = current_time();
1006 print STDERR "$now $prefix Connected to database with mysql child process (pid=$mysql_pid)\n";
1007 print MYSQL_WRITER "SET SESSION wait_timeout = 2147000;\n" or die "Connection to mysql child process failed: $!";
1008
1009 mysql_check();
1010}
1011
1012
1013#
1014# mysql_check subroutine checks that the connection to mysql child process
1015# is ok.
1016#
1017sub mysql_check {
1018 my $mysql_pid_copy = $mysql_pid;988 my $mysql_pid_copy = $mysql_pid;
1019989
1020 # send a dummy query to mysql child process990 # send a dummy query to mysql child process
1021 $hello_id++;991 $hello_id++;
1022 my $hello_message = "innobackup hello $hello_id";992
993 my $hello_message = "xtrabackup ping $hello_id";
1023 print MYSQL_WRITER "select '$hello_message';\n" 994 print MYSQL_WRITER "select '$hello_message';\n"
1024 or Die "Connection to mysql child process failed: $!";995 or Die "Connection to mysql child process failed: $!";
1025996
@@ -1051,21 +1022,54 @@
1051 . " You may adjust time limit by editing the value of parameter"1022 . " You may adjust time limit by editing the value of parameter"
1052 . " \"\$mysql_response_timeout\" in this script.)";1023 . " \"\$mysql_response_timeout\" in this script.)";
1053 } elsif ($@) { Die $@; }1024 } elsif ($@) { Die $@; }
1054 1025}
1055 $mysql_last_access_time = time();1026
1056}1027
10571028#
10581029# SIGALRM handler which sends a keepalive query to the server
1059#1030#
1060# mysql_keep_alive subroutine tries to keep connection to the mysqld database1031sub catch_sigalrm {
1061# server alive by sending a dummy query when the connection has been idle1032 mysql_ping();
1062# for the specified time.1033 # Reschedule SIGALRM
1063#1034 alarm $mysql_keep_alive;
1064sub mysql_keep_alive {1035}
1065 if ((time() - $mysql_last_access_time) > $mysql_keep_alive_timeout) {1036
1066 # too long idle, send a dummy query1037
1067 mysql_check();1038#
1068 }1039# Schedule periodic server pings
1040#
1041sub start_keepalives {
1042 $SIG{ALRM} = \&catch_sigalrm;
1043 alarm $mysql_keep_alive;
1044}
1045
1046#
1047# Cancel periodic server pings
1048#
1049sub stop_keepalives {
1050 alarm 0;
1051 $SIG{ALRM} = "DEFAULT";
1052}
1053
1054#
1055# mysql_open subroutine starts mysql as a child process with
1056# a pipe connection.
1057#
1058sub mysql_open {
1059 my $options = get_mysql_options();
1060 # run mysql as a child process with a pipe connection
1061 $now = current_time();
1062 (my $prt_options = $options) =~ s/--password=[^ ]+ /--password=xxxxxxxx /g;
1063 print STDERR "$now $prefix Starting mysql with options: $prt_options\n";
1064 $mysql_pid = open(*MYSQL_WRITER, "| mysql $options >$mysql_stdout 2>$mysql_stderr ") or Die "Failed to spawn mysql child process: $!";
1065 MYSQL_WRITER->autoflush(1);
1066 $now = current_time();
1067 print STDERR "$now $prefix Connected to database with mysql child process (pid=$mysql_pid)\n";
1068 print MYSQL_WRITER "SET SESSION wait_timeout = 2147000;\n" or die "Connection to mysql child process failed: $!";
1069
1070 mysql_ping();
1071
1072 start_keepalives();
1069}1073}
10701074
10711075
@@ -1079,10 +1083,14 @@
1079sub mysql_send {1083sub mysql_send {
1080 my $request = shift;1084 my $request = shift;
10811085
1086 stop_keepalives();
1087
1082 $current_mysql_request = $request;1088 $current_mysql_request = $request;
1083 print MYSQL_WRITER "$request\n";1089 print MYSQL_WRITER "$request\n";
1084 mysql_check();1090 mysql_ping();
1085 $current_mysql_request = '';1091 $current_mysql_request = '';
1092
1093 start_keepalives();
1086}1094}
1087 1095
10881096
@@ -1090,6 +1098,8 @@
1090# mysql_close subroutine terminates mysql child process gracefully.1098# mysql_close subroutine terminates mysql child process gracefully.
1091# 1099#
1092sub mysql_close {1100sub mysql_close {
1101 stop_keepalives();
1102
1093 print MYSQL_WRITER "quit\n";1103 print MYSQL_WRITER "quit\n";
1094 $now = current_time();1104 $now = current_time();
1095 print STDERR "$now $prefix Connection to database server closed\n";1105 print STDERR "$now $prefix Connection to database server closed\n";
@@ -1852,9 +1862,6 @@
1852 "'$source_dir/$database/$wildcard' ($file_c files)\n";1862 "'$source_dir/$database/$wildcard' ($file_c files)\n";
1853 }1863 }
1854 foreach $file (@list) {1864 foreach $file (@list) {
1855 # copying may take a long time, so we have to prevent
1856 # mysql connection from timing out
1857 mysql_keep_alive();
1858 next unless check_if_required($database, $file);1865 next unless check_if_required($database, $file);
18591866
1860 if($option_include) {1867 if($option_include) {
18611868
=== added file 'test/t/bug884737.sh'
--- test/t/bug884737.sh 1970-01-01 00:00:00 +0000
+++ test/t/bug884737.sh 2011-11-14 07:14:52 +0000
@@ -0,0 +1,14 @@
1########################################################################
2# Bug #884737: xtrabackup's --parallel option asserts / crashes with a
3# value of -1
4########################################################################
5
6. inc/common.sh
7
8init
9run_mysqld
10
11# Check that --parallel=<negative value> doesn't blow up
12vlog "Creating the backup directory: $topdir/backup"
13mkdir -p $topdir/backup
14innobackupex $topdir/backup --parallel=-1
015
=== modified file 'xtrabackup.c'
--- xtrabackup.c 2011-10-05 02:31:10 +0000
+++ xtrabackup.c 2011-11-14 07:14:52 +0000
@@ -708,7 +708,7 @@
708708
709ibool xtrabackup_logfile_is_renamed = FALSE;709ibool xtrabackup_logfile_is_renamed = FALSE;
710710
711uint parallel;711int parallel;
712712
713/* === metadata of backup === */713/* === metadata of backup === */
714#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"714#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
@@ -1043,8 +1043,8 @@
1043 {"parallel", OPT_XTRA_PARALLEL,1043 {"parallel", OPT_XTRA_PARALLEL,
1044 "Number of threads to use for parallel datafiles transfer. Does not have "1044 "Number of threads to use for parallel datafiles transfer. Does not have "
1045 "any effect in the stream mode. The default value is 1.",1045 "any effect in the stream mode. The default value is 1.",
1046 (G_PTR*) &parallel, (G_PTR*) &parallel, 0, GET_UINT, REQUIRED_ARG,1046 (G_PTR*) &parallel, (G_PTR*) &parallel, 0, GET_INT, REQUIRED_ARG,
1047 1, 1, UINT_MAX, 0, 0, 0},1047 1, 1, INT_MAX, 0, 0, 0},
10481048
1049 {"innodb_adaptive_hash_index", OPT_INNODB_ADAPTIVE_HASH_INDEX,1049 {"innodb_adaptive_hash_index", OPT_INNODB_ADAPTIVE_HASH_INDEX,
1050 "Enable InnoDB adaptive hash index (enabled by default). "1050 "Enable InnoDB adaptive hash index (enabled by default). "
@@ -4107,7 +4107,7 @@
4107 count = parallel;4107 count = parallel;
4108 count_mutex = OS_MUTEX_CREATE();4108 count_mutex = OS_MUTEX_CREATE();
41094109
4110 for (i = 0; i < parallel; i++) {4110 for (i = 0; i < (uint) parallel; i++) {
4111 data_threads[i].it = it;4111 data_threads[i].it = it;
4112 data_threads[i].num = i+1;4112 data_threads[i].num = i+1;
4113 data_threads[i].count = &count;4113 data_threads[i].count = &count;

Subscribers

People subscribed via source and target branches