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

Proposed by Alexey Kopytov
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 5066
Proposed branch: lp:~akopytov/percona-xtrabackup/bug1418584-2.2
Merge into: lp:percona-xtrabackup/2.2
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.2
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+249479@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storage/innobase/xtrabackup/src/wsrep.cc'
2--- storage/innobase/xtrabackup/src/wsrep.cc 2014-09-04 16:53:33 +0000
3+++ storage/innobase/xtrabackup/src/wsrep.cc 2015-02-12 12:18:10 +0000
4@@ -56,6 +56,9 @@
5 /*! undefined seqno */
6 #define WSREP_SEQNO_UNDEFINED (-1)
7
8+/*! Name of file where Galera info is stored on recovery */
9+#define XB_GALERA_INFO_FILENAME "xtrabackup_galera_info"
10+
11 /* Galera UUID type - for all unique IDs */
12 typedef struct wsrep_uuid {
13 uint8_t data[16];
14@@ -165,6 +168,14 @@
15 XID xid;
16 char uuid_str[40];
17 wsrep_seqno_t seqno;
18+ MY_STAT statinfo;
19+
20+ /* Do not overwrite existing an existing file to be compatible with
21+ servers with older server versions */
22+ if (my_stat(XB_GALERA_INFO_FILENAME, &statinfo, MYF(0)) != NULL) {
23+
24+ return;
25+ }
26
27 memset(&xid, 0, sizeof(xid));
28 xid.formatID = -1;
29@@ -179,11 +190,11 @@
30 return;
31 }
32
33- fp = fopen("xtrabackup_galera_info", "w");
34+ fp = fopen(XB_GALERA_INFO_FILENAME, "w");
35 if (fp == NULL) {
36
37 msg("xtrabackup: error: "
38- "could not create xtrabackup_galera_info, errno = %d\n",
39+ "could not create "XB_GALERA_INFO_FILENAME", errno = %d\n",
40 errno);
41 exit(EXIT_FAILURE);
42 }
43@@ -196,7 +207,7 @@
44 if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {
45
46 msg("xtrabackup: error: "
47- "could not write to xtrabackup_galera_info, errno = %d\n",
48+ "could not write to "XB_GALERA_INFO_FILENAME", errno = %d\n",
49 errno);
50 exit(EXIT_FAILURE);
51 }
52
53=== added file 'storage/innobase/xtrabackup/test/t/bug1418584.sh'
54--- storage/innobase/xtrabackup/test/t/bug1418584.sh 1970-01-01 00:00:00 +0000
55+++ storage/innobase/xtrabackup/test/t/bug1418584.sh 2015-02-12 12:18:10 +0000
56@@ -0,0 +1,40 @@
57+###############################################################################
58+# Bug #1418584: Do not overwrite xtrabackup_galera_info when using autorecovery
59+###############################################################################
60+
61+require_galera
62+
63+ADDR=127.0.0.1
64+
65+if [[ -n ${WSREP_DEBUG:-} ]];then
66+ start_server --log-bin=`hostname`-bin --binlog-format=ROW \
67+ --wsrep-provider=$LIBGALERA_PATH \
68+ --wsrep_cluster_address=gcomm:// \
69+ --wsrep-debug=1 --wsrep_provider_options="debug=1" \
70+ --wsrep_node_address=$ADDR
71+else
72+ start_server --log-bin=`hostname`-bin --binlog-format=ROW \
73+ --wsrep-provider=$LIBGALERA_PATH \
74+ --wsrep_cluster_address=gcomm:// --wsrep_node_address=$ADDR
75+fi
76+
77+has_backup_locks && skip_test "Requires server without backup locks support"
78+
79+backup_dir=$topdir/backup
80+
81+backup_dir=$topdir/backup
82+
83+innobackupex --no-timestamp --galera-info $backup_dir
84+
85+test -f $backup_dir/xtrabackup_galera_info ||
86+ die "xtrabackup_galera_info was not created"
87+
88+echo "test" > $backup_dir/xtrabackup_galera_info
89+
90+cp $backup_dir/xtrabackup_galera_info $backup_dir/xtrabackup_galera_info_copy
91+
92+innobackupex --apply-log $backup_dir
93+
94+# Test that xtrabackup_galera_info has not been overwritten on --apply-log
95+diff -u $backup_dir/xtrabackup_galera_info \
96+ $backup_dir/xtrabackup_galera_info_copy

Subscribers

People subscribed via source and target branches

to all changes: