Merge lp:~akopytov/percona-xtrabackup/bug1418584-2.3 into lp:percona-xtrabackup/2.3

Proposed by Alexey Kopytov on 2015-02-12
Status: Merged
Approved by: Alexey Kopytov on 2015-02-12
Approved revision: 5068
Merged at revision: 5068
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1418584-2.3
Merge into: lp:percona-xtrabackup/2.3
Diff against target: 96 lines (+54/-3)
2 files modified
storage/innobase/xtrabackup/src/wsrep.cc (+14/-3)
storage/innobase/xtrabackup/test/t/bug1418584.sh (+40/-0)
To merge this branch: bzr merge lp:~akopytov/percona-xtrabackup/bug1418584-2.3
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve on 2015-02-12
Review via email: mp+249480@code.launchpad.net
To post a comment you must log in.
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'storage/innobase/xtrabackup/src/wsrep.cc'
--- storage/innobase/xtrabackup/src/wsrep.cc 2014-09-04 16:53:33 +0000
+++ storage/innobase/xtrabackup/src/wsrep.cc 2015-02-12 12:18:29 +0000
@@ -56,6 +56,9 @@
56/*! undefined seqno */56/*! undefined seqno */
57#define WSREP_SEQNO_UNDEFINED (-1)57#define WSREP_SEQNO_UNDEFINED (-1)
5858
59/*! Name of file where Galera info is stored on recovery */
60#define XB_GALERA_INFO_FILENAME "xtrabackup_galera_info"
61
59/* Galera UUID type - for all unique IDs */62/* Galera UUID type - for all unique IDs */
60typedef struct wsrep_uuid {63typedef struct wsrep_uuid {
61 uint8_t data[16];64 uint8_t data[16];
@@ -165,6 +168,14 @@
165 XID xid;168 XID xid;
166 char uuid_str[40];169 char uuid_str[40];
167 wsrep_seqno_t seqno;170 wsrep_seqno_t seqno;
171 MY_STAT statinfo;
172
173 /* Do not overwrite existing an existing file to be compatible with
174 servers with older server versions */
175 if (my_stat(XB_GALERA_INFO_FILENAME, &statinfo, MYF(0)) != NULL) {
176
177 return;
178 }
168179
169 memset(&xid, 0, sizeof(xid));180 memset(&xid, 0, sizeof(xid));
170 xid.formatID = -1;181 xid.formatID = -1;
@@ -179,11 +190,11 @@
179 return;190 return;
180 }191 }
181192
182 fp = fopen("xtrabackup_galera_info", "w");193 fp = fopen(XB_GALERA_INFO_FILENAME, "w");
183 if (fp == NULL) {194 if (fp == NULL) {
184195
185 msg("xtrabackup: error: "196 msg("xtrabackup: error: "
186 "could not create xtrabackup_galera_info, errno = %d\n",197 "could not create "XB_GALERA_INFO_FILENAME", errno = %d\n",
187 errno);198 errno);
188 exit(EXIT_FAILURE);199 exit(EXIT_FAILURE);
189 }200 }
@@ -196,7 +207,7 @@
196 if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {207 if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {
197208
198 msg("xtrabackup: error: "209 msg("xtrabackup: error: "
199 "could not write to xtrabackup_galera_info, errno = %d\n",210 "could not write to "XB_GALERA_INFO_FILENAME", errno = %d\n",
200 errno);211 errno);
201 exit(EXIT_FAILURE);212 exit(EXIT_FAILURE);
202 }213 }
203214
=== added file 'storage/innobase/xtrabackup/test/t/bug1418584.sh'
--- storage/innobase/xtrabackup/test/t/bug1418584.sh 1970-01-01 00:00:00 +0000
+++ storage/innobase/xtrabackup/test/t/bug1418584.sh 2015-02-12 12:18:29 +0000
@@ -0,0 +1,40 @@
1###############################################################################
2# Bug #1418584: Do not overwrite xtrabackup_galera_info when using autorecovery
3###############################################################################
4
5require_galera
6
7ADDR=127.0.0.1
8
9if [[ -n ${WSREP_DEBUG:-} ]];then
10 start_server --log-bin=`hostname`-bin --binlog-format=ROW \
11 --wsrep-provider=$LIBGALERA_PATH \
12 --wsrep_cluster_address=gcomm:// \
13 --wsrep-debug=1 --wsrep_provider_options="debug=1" \
14 --wsrep_node_address=$ADDR
15else
16 start_server --log-bin=`hostname`-bin --binlog-format=ROW \
17 --wsrep-provider=$LIBGALERA_PATH \
18 --wsrep_cluster_address=gcomm:// --wsrep_node_address=$ADDR
19fi
20
21has_backup_locks && skip_test "Requires server without backup locks support"
22
23backup_dir=$topdir/backup
24
25backup_dir=$topdir/backup
26
27innobackupex --no-timestamp --galera-info $backup_dir
28
29test -f $backup_dir/xtrabackup_galera_info ||
30 die "xtrabackup_galera_info was not created"
31
32echo "test" > $backup_dir/xtrabackup_galera_info
33
34cp $backup_dir/xtrabackup_galera_info $backup_dir/xtrabackup_galera_info_copy
35
36innobackupex --apply-log $backup_dir
37
38# Test that xtrabackup_galera_info has not been overwritten on --apply-log
39diff -u $backup_dir/xtrabackup_galera_info \
40 $backup_dir/xtrabackup_galera_info_copy

Subscribers

People subscribed via source and target branches

to all changes: