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
222744c5
Commit
222744c5
authored
Sep 16, 2024
by
Julius Goryavsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
galera SST scripts: fixing glitchy sockstat issues for FreeBSD
parent
45be538c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
scripts/wsrep_sst_common.sh
scripts/wsrep_sst_common.sh
+14
-6
scripts/wsrep_sst_rsync.sh
scripts/wsrep_sst_rsync.sh
+13
-6
No files found.
scripts/wsrep_sst_common.sh
View file @
222744c5
...
...
@@ -1233,6 +1233,7 @@ check_sockets_utils()
# sockstat in FreeBSD is different from other systems,
# let's denote it with a different value:
sockstat_available
=
2
sockstat_opts
=
'-46lq -P tcp -p'
fi
else
socket_utility
=
"
$(
commandex lsof
)
"
...
...
@@ -1277,18 +1278,25 @@ check_port()
[
$pid
-le
0
]
&&
pid
=
'[0-9]+'
local
rc
=
1
local
rc
=
2
# ENOENT
if
[
$ss_available
-ne
0
]
;
then
$socket_utility
$ss_opts
-t
"( sport = :
$port
)"
2>/dev/null |
\
grep
-q
-E
"[[:space:]]users:[[:space:]]?
\\
(.*
\\
(
\"
(
$utils
)[^[:space:]]*
\"
[^)]*,pid=
$pid
(,[^)]*)?
\\
)"
&&
rc
=
0
elif
[
$sockstat_available
-ne
0
]
;
then
if
[
$sockstat_available
-gt
1
]
;
then
# sockstat on FreeBSD does not return the connection
# state without special option that cancel filtering
# by the port, so we ignore the connection state for
# this system:
$socket_utility
$sockstat_opts
"
$port
"
2>/dev/null |
\
# The sockstat command on FreeBSD does not return
# the connection state without special option, but
# it supports filtering by connection state:
local
out
out
=
$(
$socket_utility
$sockstat_opts
"
$port
"
2>/dev/null
)
||
rc
=
16
# EBUSY
# On FreeBSD, the sockstat utility may exit without
# any output due to locking issues in certain versions;
# let's return a special exit code in such cases:
if
[
$rc
-eq
16
-o
-z
"
$out
"
]
;
then
return
16
# EBUSY
fi
echo
"
$out
"
|
\
grep
-q
-E
"^[^[:space:]]+[[:space:]]+(
$utils
)[^[:space:]]*[[:space:]]+
$pid
([[:space:]]|
\$
)"
&&
rc
=
0
else
$socket_utility
$sockstat_opts
"
$port
"
2>/dev/null |
\
...
...
scripts/wsrep_sst_rsync.sh
View file @
222744c5
...
...
@@ -112,11 +112,11 @@ check_pid_and_port()
grep
-o
-E
"([^[:space:]]+[[:space:]]+){4}[^[:space:]]+"
||
:
)
else
if
[
$sockstat_available
-gt
1
]
;
then
#
sockstat on FreeBSD does not return the connectio
n
#
state without special option that cancel filtering
#
by the port, so we ignore the connection state for
#
this system, also on the FreeBSD sockstat utility
# produces an
additional
column:
#
The sockstat command on FreeBSD does not retur
n
#
the connection state without special option, but
#
it supports filtering by connection state.
#
Additionally, the sockstat utility on FreeBSD
# produces an
one extra
column:
port_info
=
$(
$socket_utility
$sockstat_opts
"
$port
"
2>/dev/null |
\
grep
-o
-E
"([^[:space:]]+[[:space:]]+){5}[^[:space:]]+"
||
:
)
else
...
...
@@ -149,7 +149,14 @@ check_pid_and_port()
return
1
fi
if
!
check_port
$pid
"
$port
"
"
$utils
"
;
then
local
rc
=
0
check_port
$pid
"
$port
"
"
$utils
"
||
rc
=
$?
if
[
$rc
-eq
16
]
;
then
# We will ignore the return code EBUSY, which indicates
# a failed attempt to run the utility for retrieving
# socket information (on some systems):
return
1
elif
[
$rc
-ne
0
]
;
then
wsrep_log_error
"rsync or stunnel daemon port '
$port
'"
\
"has been taken by another program"
exit
16
# EBUSY
...
...
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