-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pxc 4607 #2018
Closed
+158
−86
Closed
Pxc 4607 #2018
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7b665bf
removing new line
Tusamarco 3e3af83
Fixing mtr 1
Tusamarco bc8bcc9
Fixing mtr 2
Tusamarco 01df920
Synchronise donor - joiner clone plugin persistency
Tusamarco a262bda
We have an issue when not using jemalloc in correctly reading this se…
Tusamarco f4bd8a0
resolving conflicts with PXC-4469
Tusamarco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,4 +182,4 @@ COUNT(*) = 0 | |
1 | ||
DROP TABLE t1; | ||
COMMIT; | ||
SET AUTOCOMMIT=ON; | ||
SET AUTOCOMMIT=ON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,15 +223,15 @@ cleanup_donor() | |
then | ||
CLEANUP_CLONE_PLUGIN="UNINSTALL PLUGIN CLONE;" | ||
else | ||
CLEANUP_CLONE_PLUGIN="" | ||
if [ "$CLEANUP_CLONE_SSL" == "yes" ] | ||
then | ||
wsrep_log_debug "-> SSL DONOR reset clone_ssl variables [CLEANUP_CLONE_SSL: $CLEANUP_CLONE_SSL]" | ||
wsrep_log_debug "-> SSL DONOR reset clone_ssl variables [CLEANUP_CLONE_SSL: $CLEANUP_CLONE_SSL CLEANUP_CLONE_PLUGIN: $CLEANUP_CLONE_PLUGIN ]" | ||
$MYSQL_ACLIENT -e "SET wsrep_on=OFF; | ||
SET GLOBAL clone_ssl_cert=''; | ||
SET GLOBAL clone_ssl_key=''; | ||
SET GLOBAL clone_ssl_ca='';" || : | ||
fi | ||
CLEANUP_CLONE_PLUGIN="" | ||
fi | ||
if [ ! "$WSREP_SST_OPT_REMOTE_JOINER_USER" == "" ]; then | ||
$MYSQL_ACLIENT -e "SET wsrep_on=OFF; DROP USER IF EXISTS '$WSREP_SST_OPT_REMOTE_JOINER_USER'@'%'; $CLEANUP_CLONE_PLUGIN" || : | ||
|
@@ -358,12 +358,14 @@ setup_clone_plugin() | |
WSREP_OFF="" # joiner does not have replication enabled | ||
fi | ||
$MYSQL_ACLIENT -e "${WSREP_OFF}INSTALL PLUGIN CLONE SONAME 'mysql_clone.so';" | ||
CLEANUP_CLONE_PLUGIN="yes" | ||
if [ "$ROLE" == "donor" ]; then | ||
CLEANUP_CLONE_PLUGIN="yes" | ||
fi | ||
CLONE_SSL_CERT="NULL" | ||
CLONE_SSL_KEY="NULL" | ||
CLONE_SSL_CA="NULL" | ||
else | ||
CLEANUP_CLONE_PLUGIN="" | ||
CLEANUP_CLONE_PLUGIN="no" | ||
CLONE_SSL_CERT=`$MYSQL_ACLIENT -e "SELECT @@clone_ssl_cert"` | ||
CLONE_SSL_KEY=`$MYSQL_ACLIENT -e "SELECT @@clone_ssl_key"` | ||
CLONE_SSL_CA=`$MYSQL_ACLIENT -e "SELECT @@clone_ssl_ca"` | ||
|
@@ -376,7 +378,7 @@ setup_clone_plugin() | |
local CLIENT_SSL_CA=$(parse_cnf sst ssl_ca "") | ||
local CLIENT_SSL_MODE=$(parse_cnf sst ssl_mode "") | ||
|
||
if [ -z "$CLIENT_SSL_CERT" -o -z "$CLIENT_SSL_KEY" ] | ||
if [ -z "$CLIENT_SSL_CERT" -o "$CLIENT_SSL_CERT" == "" ] | ||
then | ||
CLIENT_SSL_CERT=$(parse_cnf client ssl_cert "") | ||
CLIENT_SSL_KEY=$(parse_cnf client ssl_key "") | ||
|
@@ -392,7 +394,7 @@ setup_clone_plugin() | |
[ "$SERVER_SSL_KEY" = "NULL" ] && SERVER_SSL_KEY= | ||
[ "$SERVER_SSL_CA" = "NULL" ] && SERVER_SSL_CA= | ||
|
||
if [ "$CLONE_SSL_CERT" = "NULL" -o "$CLONE_SSL_KEY" = "NULL" ] | ||
if [ "$CLONE_SSL_CERT" == "NULL" -o "$CLONE_SSL_CERT" = "" ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mixture of single |
||
then | ||
wsrep_log_info "CLONE SSL not configured. Checking general MySQL SSL settings." | ||
|
||
|
@@ -413,7 +415,9 @@ setup_clone_plugin() | |
$MYSQL_ACLIENT -e "SET GLOBAL clone_ssl_cert='$CLONE_SSL_CERT'" | ||
$MYSQL_ACLIENT -e "SET GLOBAL clone_ssl_key='$CLONE_SSL_KEY'" | ||
$MYSQL_ACLIENT -e "SET GLOBAL clone_ssl_ca='$CLONE_SSL_CA'" | ||
CLEANUP_CLONE_SSL="yes" | ||
if [ "$CLEANUP_CLONE_PLUGIN" == "yes" ]; then | ||
CLEANUP_CLONE_SSL="yes" | ||
fi | ||
fi | ||
else | ||
if [ -n "$CLONE_SSL_CERT" -a -n "$CLONE_SSL_KEY" ] | ||
|
@@ -451,10 +455,6 @@ setup_clone_plugin() | |
CLEANUP_CLONE_SSL= | ||
REQUIRE_SSL="" | ||
fi | ||
# for now we force no SSL in the clone operations | ||
# CLEANUP_CLONE_SSL= | ||
# REQUIRE_SSL= | ||
# wsrep_log_info "SSL Not supported yet." | ||
wsrep_log_debug "-> ############## SSL SECTION [END] ($ROLE)############" | ||
} | ||
|
||
|
@@ -542,7 +542,7 @@ then | |
setup_clone_plugin "donor" | ||
|
||
# wsrep_log_info "REQUIRE_SSL=$REQUIRE_SSL, CLIENT_SSL_OPTIONS=$CLIENT_SSL_OPTIONS" | ||
wsrep_log_debug "-> PREPARED DONE" | ||
wsrep_log_debug "-> PREPARE DONE" | ||
|
||
cat << EOF > "$CLONE_PREPARE_SQL" | ||
SET wsrep_on=OFF; | ||
|
@@ -565,7 +565,8 @@ EOF | |
fi | ||
# Before waiting for the Joiner Clone mysql we send out the message this is a SST | ||
wsrep_log_debug "-> NETCAT signal to nc -w 1 $SST_HOST_STRIPPED $WSREP_SST_OPT_REMOTE_HOSTPORT" | ||
echo "SST@$WSREP_SST_OPT_GTID<EOF>" | nc -w 1 $SST_HOST_STRIPPED $WSREP_SST_OPT_REMOTE_HOSTPORT || : | ||
wsrep_log_debug "-> Signal for CLONE Plugin CLEANUP_CLONE_PLUGIN=$CLEANUP_CLONE_PLUGIN" | ||
echo "$CLEANUP_CLONE_PLUGIN|SST@$WSREP_SST_OPT_GTID<EOF>" | nc -w 1 $SST_HOST_STRIPPED $WSREP_SST_OPT_REMOTE_HOSTPORT || : | ||
|
||
# We stay on hold now, waiting for the Joiner to expose the service | ||
wsrep_log_info "-> WAIT for Joiner MySQL to be available nc -w 1 -i 1 $SST_HOST_STRIPPED $WSREP_SST_OPT_REMOTE_HOSTPORT" | ||
|
@@ -610,9 +611,9 @@ EOF | |
wsrep_log_debug "-> $CLONE_EXECUTE" | ||
|
||
# Actual cloning process | ||
wsrep_log_info "JOINER CLONE ACTION CLONING: cloning" | ||
wsrep_log_info "JOINER CLONE ACTION: cloning" | ||
LOCALOUTPUT=`$MYSQL_RCLIENT --connect-timeout=60 $CLIENT_SSL_OPTIONS < $CLONE_EXECUTE_SQL 2>&1 || RC=$?` | ||
wsrep_log_info "JOINER CLONE ACTION CLONING: done $RC" | ||
wsrep_log_info "JOINER CLONE ACTION: cloning done $RC" | ||
wsrep_log_debug "-> LOCALOUTPUT: $LOCALOUTPUT" | ||
|
||
|
||
|
@@ -642,6 +643,7 @@ EOF | |
esac | ||
exit $RC | ||
fi | ||
CLEANUP_CLONE_SSL="yes" | ||
cleanup_donor | ||
else # BYPASS | ||
wsrep_log_info "Bypassing state dump." | ||
|
@@ -928,10 +930,12 @@ then | |
echo $RP_PURGED | ||
exit 0 | ||
else | ||
wsrep_log_info "DONOR SAY SST" | ||
RP_PURGED=`cat $WSREP_SST_OPT_DATA/XST_FILE.txt` | ||
RP_PURGED_EMERGENCY=${RP_PURGED#"SST@"} | ||
wsrep_log_info "DONOR SAY SST ($RP_PURGED)" | ||
readonly CLEANUP_CLONE_PLUGIN=${RP_PURGED%|SST*} | ||
RP_PURGED_EMERGENCY=${RP_PURGED#*SST@} | ||
RP_PURGED_EMERGENCY=${RP_PURGED_EMERGENCY%"<EOF>"} | ||
wsrep_log_debug "-> CLONE Plugin to remove? (yes/no) = $CLEANUP_CLONE_PLUGIN" | ||
wsrep_log_debug "-> recovered position from DONOR: $RP_PURGED_EMERGENCY" | ||
fi | ||
|
||
|
@@ -1075,19 +1079,24 @@ EOF | |
wsrep_log_info "Performing data recovery" | ||
wsrep_log_debug "-> RECOVERY COMMAND LINE: $CLONE_ENV $CLONE_BINARY $DEFAULT_OPTIONS --wsrep_provider=none" | ||
|
||
# Instance should have been gone, but we check the p | ||
# Instance should been gone, but we check the pid | ||
if [ -s "$CLONE_PID_FILE" ]; then | ||
wsrep_log_debug "Cleaning leftover from previous mysqld run $CLONE_PID_FILE" | ||
kill -9 `cat $CLONE_PID_FILE` || true | ||
rm -f $CLONE_PID_FILE || true | ||
fi | ||
|
||
# Remove created clone user and SST pxc user | ||
# Remove created clone user and SST pxc user | ||
wsrep_log_debug "-> CLEAN OR NOT? $CLEANUP_CLONE_PLUGIN" | ||
CLEANUP_CLONE_PLUGIN_SQL="" | ||
if [ "${CLEANUP_CLONE_PLUGIN}" == "yes" ]; then | ||
CLEANUP_CLONE_PLUGIN_SQL="UNINSTALL PLUGIN CLONE;" | ||
fi | ||
cat << EOF > "$CLONE_SQL" | ||
SET SESSION sql_log_bin=OFF; | ||
DROP USER IF EXISTS $CLONE_USER; | ||
DROP USER IF EXISTS $CLONE_USER@'localhost'; | ||
DROP USER IF EXISTS 'mysql.pxc.sst.user'@'localhost'; | ||
DROP USER IF EXISTS 'mysql.pxc.sst.user'@'localhost'; $CLEANUP_CLONE_PLUGIN_SQL | ||
SHUTDOWN; | ||
EOF | ||
|
||
|
@@ -1140,8 +1149,8 @@ EOF | |
sleep 1 | ||
exit 0 | ||
fi | ||
# Forcing restart of parent | ||
CLEAN FILES=1 | ||
# We terminate but save the log for inspections given the failure | ||
CLEANUP_FILES=0 | ||
wsrep_cleanup_progress_file | ||
cleanup_joiner | ||
wsrep_log_debug "-> Invalid Recovery position. Exiting with error 61 (No data available )" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not consistent across the script how we do the comparison. Sometimes it is
==
and sometimes it it=
(just 4 lines above).=
is posix compatible and should be used with single brackets[...]
==
is bash only compatible and should be used with double brackets[[...]]
Would it be possible to have it consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will review all in a different branch/pr