Merge lp:~akopytov/percona-xtrabackup/bug834657-1.6 into lp:percona-xtrabackup/1.6

Proposed by Alexey Kopytov
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 281
Proposed branch: lp:~akopytov/percona-xtrabackup/bug834657-1.6
Merge into: lp:percona-xtrabackup/1.6
Diff against target: 113 lines (+53/-10)
2 files modified
innobackupex (+25/-10)
test/t/ib_slave_info.sh (+28/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug834657-1.6
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Review via email: mp+73321@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) :
review: Approve
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
1=== modified file 'innobackupex'
2--- innobackupex 2011-06-11 08:00:46 +0000
3+++ innobackupex 2011-08-30 03:13:23 +0000
4@@ -359,20 +359,25 @@
5 wait_for_ibbackup_suspend();
6 }
7
8+ if ($option_safe_slave_backup) {
9+ mysql_open();
10+ mysql_check();
11+ wait_for_safe_slave();
12+ mysql_close();
13+ }
14+
15 if (!$option_incremental) {
16 # connect to database
17 mysql_open();
18
19- if ( $option_safe_slave_backup ) {
20- wait_for_safe_slave();
21- }
22-
23 # flush tables with read lock
24 mysql_check();
25 mysql_lockall() if !$option_no_lock;
26
27 }
28
29+ write_slave_info() if $option_slave_info;
30+
31 # backup .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files
32 backup_files();
33
34@@ -383,15 +388,18 @@
35 # release read locks on all tables
36 mysql_unlockall() if !$option_no_lock;
37
38- if ( $option_safe_slave_backup ) {
39- print STDERR "$prefix: Starting slave SQL thread\n";
40- mysql_send('START SLAVE SQL_THREAD;');
41- }
42-
43 # disconnect from database
44 mysql_close();
45 }
46
47+ if ( $option_safe_slave_backup ) {
48+ mysql_open();
49+ mysql_check();
50+ print STDERR "$prefix: Starting slave SQL thread\n";
51+ mysql_send('START SLAVE SQL_THREAD;');
52+ mysql_close();
53+ }
54+
55 if ($option_remote_host) {
56 system("scp $option_scp_opt '$tmp_logfile' '$option_remote_host:$backup_dir/xtrabackup_logfile'")
57 and Die "Failed to scp file '$option_remote_host:$backup_dir/xtrabackup_logfile': $!";
58@@ -1203,7 +1211,6 @@
59 mysql_send "COMMIT;";
60 }
61 write_binlog_info;
62- write_slave_info if $option_slave_info;
63
64 $now = current_time();
65 print STDERR "$now $prefix All tables locked and flushed to disk\n";
66@@ -1670,6 +1677,14 @@
67 $backup_dir = File::Spec->rel2abs($ARGV[0]);
68 }
69
70+ if ($option_slave_info) {
71+ if (($option_no_lock or $option_incremental) and
72+ !$option_safe_slave_backup) {
73+ print STDERR "--slave-info is used with either --no-lock or --incremental but without --safe-slave-backup. The binlog position cannot be consistent with the backup data.\n";
74+ exit(1);
75+ }
76+ }
77+
78 print STDERR "\n";
79
80 parse_databases_option_value();
81
82=== added file 'test/t/ib_slave_info.sh'
83--- test/t/ib_slave_info.sh 1970-01-01 00:00:00 +0000
84+++ test/t/ib_slave_info.sh 2011-08-30 03:13:23 +0000
85@@ -0,0 +1,28 @@
86+. inc/common.sh
87+
88+init
89+run_mysqld --innodb_file_per_table
90+load_dbase_schema incremental_sample
91+
92+# Adding initial rows
93+vlog "Adding initial rows to database..."
94+numrow=100
95+count=0
96+while [ "$numrow" -gt "$count" ]
97+do
98+ ${MYSQL} ${MYSQL_ARGS} -e "insert into test values ($count, $numrow);" incremental_sample
99+ let "count=count+1"
100+done
101+vlog "Initial rows added"
102+
103+# Full backup
104+# backup root directory
105+mkdir -p $topdir/backup
106+
107+vlog "Check that --slave-info with --no-lock and no --safe-slave-backup fails"
108+run_cmd_expect_failure $IB_BIN $IB_ARGS --slave-info --no-lock $topdir/backup
109+
110+vlog "Check that --slave-info with --incremental and no --safe-slave-backup fails"
111+run_cmd_expect_failure $IB_BIN $IB_ARGS --slave-info --incremental --incremental-basedir=$topdir/backup $topdir/backup
112+
113+# TODO: add positive tests when the test suite is able to setup replication

Subscribers

People subscribed via source and target branches