Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
46a5d2f1
Commit
46a5d2f1
authored
Sep 15, 2024
by
Julius Goryavsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
galera SST scripts: unification of the previous SST completion check
parent
7742cc9f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
91 deletions
+74
-91
scripts/wsrep_sst_backup.sh
scripts/wsrep_sst_backup.sh
+2
-5
scripts/wsrep_sst_common.sh
scripts/wsrep_sst_common.sh
+26
-1
scripts/wsrep_sst_mariabackup.sh
scripts/wsrep_sst_mariabackup.sh
+29
-50
scripts/wsrep_sst_mysqldump.sh
scripts/wsrep_sst_mysqldump.sh
+2
-0
scripts/wsrep_sst_rsync.sh
scripts/wsrep_sst_rsync.sh
+15
-35
No files found.
scripts/wsrep_sst_backup.sh
View file @
46a5d2f1
...
...
@@ -22,14 +22,11 @@ set -ue
# This is a reference script for rsync-based state snapshot transfer
.
$(
dirname
"
$0
"
)
/wsrep_sst_common
wsrep_check_datadir
DATA
=
"
$WSREP_SST_OPT_DATA
"
create_data
MAGIC_FILE
=
"
$DATA
/backup_sst_complete"
wait_previous_sst
[
-f
"
$MAGIC_FILE
"
]
&&
rm
-f
"
$MAGIC_FILE
"
if
[
"
$WSREP_SST_OPT_ROLE
"
=
'donor'
]
...
...
scripts/wsrep_sst_common.sh
View file @
46a5d2f1
...
...
@@ -1769,7 +1769,7 @@ simple_cleanup()
if [
$estatus
-ne 0 ]; then
wsrep_log_error "
Cleanup
after exit with status
:
$estatus
"
fi
if [ -n "
$
{
SST_PID
:-}
" ]; then
if [ -n "
$
SST_PID
" ]; then
[ "
$(
pwd
)
" != "
$OLD_PWD
" ] && cd "
$OLD_PWD
"
[ -f "
$SST_PID
" ] && rm -f "
$SST_PID
" || :
fi
...
...
@@ -1869,4 +1869,29 @@ create_dirs()
fi
}
wait_previous_sst()
{
# give some time for previous SST to complete:
check_round=0
while check_pid "
$SST_PID
" 1; do
wsrep_log_info "
Previous
SST is not completed, waiting for it to exit
"
check_round=
$((
check_round+1
))
if [
$check_round
-eq 30 ]; then
wsrep_log_error "
previous
SST script still running...
"
exit 114 # EALREADY
fi
sleep 1
done
trap simple_cleanup EXIT
echo
$$
> "
$SST_PID
"
}
DATA="
$WSREP_SST_OPT_DATA
"
wsrep_check_datadir
create_data
SST_PID="
$DATA
/wsrep_sst.pid
"
wsrep_log_info "
$WSREP_METHOD
$WSREP_TRANSFER_TYPE
started on
$WSREP_SST_OPT_ROLE
"
scripts/wsrep_sst_mariabackup.sh
View file @
46a5d2f1
...
...
@@ -24,7 +24,21 @@ set -ue
# Make sure to read that before proceeding!
.
$(
dirname
"
$0
"
)
/wsrep_sst_common
wsrep_check_datadir
BACKUP_BIN
=
$(
commandex
'mariadb-backup'
)
if
[
-z
"
$BACKUP_BIN
"
]
;
then
wsrep_log_error
'mariadb-backup binary not found in path'
exit
42
fi
BACKUP_PID
=
""
INFO_FILE
=
'xtrabackup_galera_info'
DONOR_INFO_FILE
=
'donor_galera_info'
IST_FILE
=
'xtrabackup_ist'
MAGIC_FILE
=
"
$DATA
/
$INFO_FILE
"
DONOR_MAGIC_FILE
=
"
$DATA
/
$DONOR_INFO_FILE
"
ealgo
=
""
eformat
=
""
...
...
@@ -33,7 +47,6 @@ ekeyfile=""
encrypt
=
0
ssyslog
=
""
ssystag
=
""
BACKUP_PID
=
""
tcert
=
""
tcap
=
""
tpem
=
""
...
...
@@ -62,10 +75,10 @@ tcmd=""
payload
=
0
pvformat
=
"-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p'"
pvopts
=
"-f -i 10 -N
$WSREP_SST_OPT_ROLE
"
STATDIR
=
""
uextra
=
0
disver
=
""
STATDIR
=
""
tmpopts
=
""
itmpdir
=
""
xtmpdir
=
""
...
...
@@ -91,23 +104,6 @@ readonly TOTAL_TAG='total'
# For backup locks it is 1 sent by joiner
sst_ver
=
1
declare
-a
RC
BACKUP_BIN
=
$(
commandex
'mariadb-backup'
)
if
[
-z
"
$BACKUP_BIN
"
]
;
then
wsrep_log_error
'mariadb-backup binary not found in path'
exit
42
fi
DATA
=
"
$WSREP_SST_OPT_DATA
"
INFO_FILE
=
'xtrabackup_galera_info'
DONOR_INFO_FILE
=
'donor_galera_info'
IST_FILE
=
'xtrabackup_ist'
MAGIC_FILE
=
"
$DATA
/
$INFO_FILE
"
DONOR_MAGIC_FILE
=
"
$DATA
/
$DONOR_INFO_FILE
"
INNOAPPLYLOG
=
"
$DATA
/mariabackup.prepare.log"
INNOMOVELOG
=
"
$DATA
/mariabackup.move.log"
INNOBACKUPLOG
=
"
$DATA
/mariabackup.backup.log"
...
...
@@ -713,7 +709,7 @@ cleanup_at_exit()
fi
# Final cleanup
pgid
=
$(
ps
-o
'pgid='
$$
2>/dev/null |
grep
-o
-E
'[0-9]+'
||
:
)
local
pgid
=
$(
ps
-o
'pgid='
$$
2>/dev/null |
grep
-o
-E
'[0-9]+'
||
:
)
# This means no setsid done in mysqld.
# We don't want to kill mysqld here otherwise.
...
...
@@ -727,7 +723,7 @@ cleanup_at_exit()
fi
fi
if
[
-n
"
$
{
SST_PID
:-}
"
]
;
then
if
[
-n
"
$
SST_PID
"
]
;
then
[
-f
"
$SST_PID
"
]
&&
rm
-f
"
$SST_PID
"
||
:
fi
...
...
@@ -933,7 +929,17 @@ if "$BACKUP_BIN" --help 2>/dev/null | grep -qw -F -- '--version-check'; then
disver
=
' --no-version-check'
fi
create_data
get_stream
get_transfer
findopt
=
'-L'
[
"
$OS
"
=
'FreeBSD'
]
&&
findopt
=
"
$findopt
-E"
wait_previous_sst
[
-f
"
$MAGIC_FILE
"
]
&&
rm
-f
"
$MAGIC_FILE
"
[
-f
"
$DONOR_MAGIC_FILE
"
]
&&
rm
-f
"
$DONOR_MAGIC_FILE
"
[
-f
"
$DATA
/
$IST_FILE
"
]
&&
rm
-f
"
$DATA
/
$IST_FILE
"
if
[
$ssyslog
-eq
1
]
;
then
if
[
-n
"
$(
commandex logger
)
"
]
;
then
...
...
@@ -1053,30 +1059,6 @@ send_magic()
fi
}
get_stream
get_transfer
findopt
=
'-L'
[
"
$OS
"
=
'FreeBSD'
]
&&
findopt
=
"
$findopt
-E"
SST_PID
=
"
$DATA
/wsrep_sst.pid"
# give some time for previous SST to complete:
check_round
=
0
while
check_pid
"
$SST_PID
"
;
do
wsrep_log_info
"previous SST is not completed, waiting for it to exit"
check_round
=
$((
check_round+1
))
if
[
$check_round
-eq
30
]
;
then
wsrep_log_error
"previous SST script still running."
exit
114
# EALREADY
fi
sleep
1
done
[
-f
"
$MAGIC_FILE
"
]
&&
rm
-f
"
$MAGIC_FILE
"
[
-f
"
$DONOR_MAGIC_FILE
"
]
&&
rm
-f
"
$DONOR_MAGIC_FILE
"
[
-f
"
$DATA
/
$IST_FILE
"
]
&&
rm
-f
"
$DATA
/
$IST_FILE
"
if
[
"
$WSREP_SST_OPT_ROLE
"
=
'donor'
]
;
then
trap
cleanup_at_exit EXIT
...
...
@@ -1249,9 +1231,6 @@ else # joiner
impts
=
"--parallel=
$backup_threads
${
impts
:+
}
$impts
"
fi
trap
simple_cleanup EXIT
echo
$$
>
"
$SST_PID
"
stagemsg
=
'Joiner-Recv'
MODULE
=
"
${
WSREP_SST_OPT_MODULE
:-
xtrabackup_sst
}
"
...
...
scripts/wsrep_sst_mysqldump.sh
View file @
46a5d2f1
...
...
@@ -23,6 +23,8 @@ set -ue
.
$(
dirname
"
$0
"
)
/wsrep_sst_common
wait_previous_sst
EINVAL
=
22
if
test
-z
"
$WSREP_SST_OPT_HOST
"
;
then
wsrep_log_error
"HOST cannot be nil"
;
exit
$EINVAL
;
fi
...
...
scripts/wsrep_sst_rsync.sh
View file @
46a5d2f1
...
...
@@ -22,13 +22,22 @@ set -ue
# This is a reference script for rsync-based state snapshot transfer
.
$(
dirname
"
$0
"
)
/wsrep_sst_common
wsrep_check_datadir
wsrep_check_programs rsync
RSYNC_REAL_PID
=
0
# rsync process id
STUNNEL_REAL_PID
=
0
# stunnel process id
MODULE
=
"
${
WSREP_SST_OPT_MODULE
:-
rsync_sst
}
"
RSYNC_PID
=
"
$DATA
/
$MODULE
.pid"
RSYNC_CONF
=
"
$DATA
/
$MODULE
.conf"
STUNNEL_CONF
=
"
$DATA
/stunnel.conf"
STUNNEL_PID
=
"
$DATA
/stunnel.pid"
MAGIC_FILE
=
"
$DATA
/rsync_sst_complete"
cleanup_joiner
()
{
# Since this is invoked just after exit NNN
...
...
@@ -150,13 +159,6 @@ check_pid_and_port()
check_pid
"
$pid_file
"
&&
[
$CHECK_PID
-eq
$pid
]
}
DATA
=
"
$WSREP_SST_OPT_DATA
"
STUNNEL_CONF
=
"
$DATA
/stunnel.conf"
STUNNEL_PID
=
"
$DATA
/stunnel.pid"
MAGIC_FILE
=
"
$DATA
/rsync_sst_complete"
get_binlog
if
[
-n
"
$WSREP_SST_OPT_BINLOG
"
]
;
then
...
...
@@ -164,8 +166,6 @@ if [ -n "$WSREP_SST_OPT_BINLOG" ]; then
binlog_base
=
$(
basename
"
$WSREP_SST_OPT_BINLOG
"
)
fi
create_data
BINLOG_TAR_FILE
=
"
$DATA_DIR
/wsrep_sst_binlog.tar"
ar_log_dir
=
"
$DATA_DIR
"
...
...
@@ -270,22 +270,7 @@ fi
readonly
SECRET_TAG
=
'secret'
readonly
BYPASS_TAG
=
'bypass'
SST_PID
=
"
$DATA
/wsrep_sst.pid"
# give some time for previous SST to complete:
check_round
=
0
while
check_pid
"
$SST_PID
"
;
do
wsrep_log_info
"Previous SST is not completed, waiting for it to exit"
check_round
=
$((
check_round+1
))
if
[
$check_round
-eq
20
]
;
then
wsrep_log_error
"previous SST script still running."
exit
114
# EALREADY
fi
sleep
1
done
trap
simple_cleanup EXIT
echo
$$
>
"
$SST_PID
"
wait_previous_sst
# give some time for stunnel from the previous SST to complete:
check_round
=
0
...
...
@@ -293,26 +278,21 @@ while check_pid "$STUNNEL_PID" 1 "$STUNNEL_CONF"; do
wsrep_log_info
"Lingering stunnel daemon found at startup,"
\
"waiting for it to exit"
check_round
=
$((
check_round+1
))
if
[
$check_round
-eq
1
0
]
;
then
wsrep_log_error
"stunnel daemon still running."
if
[
$check_round
-eq
3
0
]
;
then
wsrep_log_error
"stunnel daemon still running.
..
"
exit
114
# EALREADY
fi
sleep
1
done
MODULE
=
"
${
WSREP_SST_OPT_MODULE
:-
rsync_sst
}
"
RSYNC_PID
=
"
$DATA
/
$MODULE
.pid"
RSYNC_CONF
=
"
$DATA
/
$MODULE
.conf"
# give some time for rsync from the previous SST to complete:
check_round
=
0
while
check_pid
"
$RSYNC_PID
"
1
"
$RSYNC_CONF
"
;
do
wsrep_log_info
"Lingering rsync daemon found at startup,"
\
"waiting for it to exit"
check_round
=
$((
check_round+1
))
if
[
$check_round
-eq
1
0
]
;
then
wsrep_log_error
"rsync daemon still running."
if
[
$check_round
-eq
3
0
]
;
then
wsrep_log_error
"rsync daemon still running.
..
"
exit
114
# EALREADY
fi
sleep
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment