Merge lp:~percona-core/percona-xtradb-cluster/bug-1380697 into lp:percona-xtradb-cluster

Proposed by Raghavendra D Prabhu on 2014-12-14
Status: Merged
Approved by: Alexey Kopytov on 2015-02-05
Approved revision: 949
Merge reported by: Raghavendra D Prabhu
Merged at revision: not available
Proposed branch: lp:~percona-core/percona-xtradb-cluster/bug-1380697
Merge into: lp:percona-xtradb-cluster
Diff against target: 144 lines (+89/-5) (has conflicts)
1 file modified
scripts/wsrep_sst_xtrabackup-v2.sh (+89/-5)
Text conflict in scripts/wsrep_sst_xtrabackup-v2.sh
To merge this branch: bzr merge lp:~percona-core/percona-xtradb-cluster/bug-1380697
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) 2014-12-14 Approve on 2015-02-05
Raghavendra D Prabhu (community) Resubmit on 2015-02-05
Review via email: mp+244678@code.launchpad.net
To post a comment you must log in.
947. By Raghavendra D Prabhu on 2014-12-17

Add syslog tag for logger

Alexey Kopytov (akopytov) :
review: Needs Fixing
948. By Raghavendra D Prabhu on 2015-02-05

Bug#1380697: Move code around to better deal with abnormal termination from signals

Fixed based on previous comments.

review: Resubmit
949. By Raghavendra D Prabhu on 2015-02-05

Bug#1380697: Refactoring for portability on non-Linux platforms

950. By Raghavendra D Prabhu on 2015-02-05

Bug#1380697: Refactoring for portability on non-Linux platforms - for other cleanup

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 'scripts/wsrep_sst_xtrabackup-v2.sh'
2--- scripts/wsrep_sst_xtrabackup-v2.sh 2015-01-27 18:34:05 +0000
3+++ scripts/wsrep_sst_xtrabackup-v2.sh 2015-02-05 13:25:40 +0000
4@@ -29,6 +29,8 @@
5 encrypt=0
6 nproc=1
7 ecode=0
8+ssyslog=""
9+ssystag=""
10 XTRABACKUP_PID=""
11 SST_PORT=""
12 REMOTEIP=""
13@@ -322,11 +324,23 @@
14 iapts=$(parse_cnf sst inno-apply-opts "")
15 impts=$(parse_cnf sst inno-move-opts "")
16 stimeout=$(parse_cnf sst sst-initial-timeout 100)
17+<<<<<<< TREE
18
19 if [[ $speciald -eq 0 ]];then
20 wsrep_log_error "sst-special-dirs equal to 0 is not supported, falling back to 1"
21 speciald=1
22 fi
23+=======
24+ ssyslog=$(parse_cnf sst sst-syslog 0)
25+ ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}")
26+ ssystag+="-"
27+
28+ if [[ $ssyslog -ne -1 ]];then
29+ if my_print_defaults -c $WSREP_SST_OPT_CONF mysqld_safe | tr '_' '-' | grep -q -- "--syslog";then
30+ ssyslog=1
31+ fi
32+ fi
33+>>>>>>> MERGE-SOURCE
34 }
35
36 get_stream()
37@@ -381,6 +395,26 @@
38 if [[ -n ${STATDIR:-} ]];then
39 [[ -d $STATDIR ]] && rm -rf $STATDIR
40 fi
41+
42+ # Final cleanup
43+ pgid=$(ps -o pgid= $$ | grep -o '[0-9]*')
44+
45+ # This means no setsid done in mysqld.
46+ # We don't want to kill mysqld here otherwise.
47+ if [[ $$ -eq $pgid ]];then
48+
49+ kill -TERM -$$ || true
50+
51+ # This means a signal was delivered to the process.
52+ # So, more cleanup.
53+ if [[ $estatus -ge 128 ]];then
54+ sleep 10
55+ kill -KILL -$$ || true
56+ fi
57+
58+ fi
59+
60+ exit $estatus
61 }
62
63 check_pid()
64@@ -421,6 +455,27 @@
65 if [[ -n $itmpdir ]];then
66 [[ -d $itmpdir ]] && rm -rf $itmpdir || true
67 fi
68+
69+ # Final cleanup
70+ pgid=$(ps -o pgid= $$ | grep -o '[0-9]*')
71+
72+ # This means no setsid done in mysqld.
73+ # We don't want to kill mysqld here otherwise.
74+ if [[ $$ -eq $pgid ]];then
75+
76+ kill -TERM -$$ || true
77+
78+ # This means a signal was delivered to the process.
79+ # So, more cleanup.
80+ if [[ $estatus -ge 128 ]];then
81+ sleep 10
82+ kill -KILL -$$ || true
83+ fi
84+
85+ fi
86+
87+ exit $estatus
88+
89 }
90
91 kill_xtrabackup()
92@@ -567,8 +622,6 @@
93
94 read_cnf
95 setup_ports
96-get_stream
97-get_transfer
98
99 if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; then
100 disver="--no-version-check"
101@@ -576,9 +629,40 @@
102
103
104 INNOEXTRA=""
105-INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log"
106-INNOMOVE="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log"
107-INNOBACKUP="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log"
108+
109+if [[ $ssyslog -eq 1 ]];then
110+
111+ if [[ ! -x `which logger` ]];then
112+ wsrep_log_error "logger not in path: $PATH. Ignoring"
113+ else
114+
115+ wsrep_log_info "Logging all stderr of SST/Innobackupex to syslog"
116+
117+ exec 2> >(logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE)
118+
119+ wsrep_log_error()
120+ {
121+ logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
122+ }
123+
124+ wsrep_log_info()
125+ {
126+ logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
127+ }
128+
129+ INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply "
130+ INNOMOVE="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move "
131+ INNOBACKUP="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)"
132+ fi
133+
134+else
135+ INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log"
136+ INNOMOVE="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log"
137+ INNOBACKUP="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log"
138+fi
139+
140+get_stream
141+get_transfer
142
143 if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
144 then

Subscribers

People subscribed via source and target branches

to all changes: