diff options
author | Nirbhay Choubey <nirbhay@skysql.com> | 2014-08-07 18:29:20 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@skysql.com> | 2014-08-07 18:29:20 -0400 |
commit | f8420992c0b604ec7b673fc8dc90312af2f800dc (patch) | |
tree | 843204783facd33ea6a593baa5681046e85b99e1 /scripts/wsrep_sst_mysqldump.sh | |
parent | 746c755d423d02a41a8e22a80e84ed4eff260ba4 (diff) | |
download | mariadb-git-f8420992c0b604ec7b673fc8dc90312af2f800dc.tar.gz |
MDEV-6490: mysqldump unknown option --galera-sst-mode
* Merged patches pushed to 10.0.
* Additional fix in wsrep_sst_mysqldump.sh to control use
of RESET MASTER and mysqldump's galera-sst-mode option based
on joiner's @@log-bin value.
Diffstat (limited to 'scripts/wsrep_sst_mysqldump.sh')
-rw-r--r-- | scripts/wsrep_sst_mysqldump.sh | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index a8ed19c5381..3f4ada39a9d 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -75,12 +75,6 @@ if test -n "$WSREP_SST_OPT_PSWD"; then AUTH="$AUTH -p$WSREP_SST_OPT_PSWD"; fi STOP_WSREP="SET wsrep_on=OFF;" -# NOTE: we don't use --routines here because we're dumping mysql.proc table -MYSQLDUMP="mysqldump $AUTH -S$WSREP_SST_OPT_SOCKET \ ---add-drop-database --add-drop-table --skip-add-locks --create-options \ ---disable-keys --extended-insert --skip-lock-tables --quick --set-charset \ ---skip-comments --flush-privileges --all-databases --galera-sst-mode" - # mysqldump cannot restore CSV tables, fix this issue CSV_TABLES_FIX=" set sql_mode=''; @@ -106,6 +100,39 @@ SET_START_POSITION="SET GLOBAL wsrep_start_position='$WSREP_SST_OPT_GTID';" MYSQL="mysql $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\ "--disable-reconnect --connect_timeout=10" +RESET_MASTER="" +OPT_GALERA_SST_MODE="" +# Check if binary logging is enabled on the joiner node. +# Note: SELECT cannot be used at this point. +LOG_BIN=$(echo "SHOW VARIABLES LIKE 'log_bin'" | $MYSQL) +LOG_BIN=$(echo $LOG_BIN | awk -F ' ' '{ print $4 }') + +# Check the joiner node's server version. +SERVER_VERSION=$(echo "SHOW VARIABLES LIKE 'version'" | $MYSQL) +SERVER_VERSION=$(echo $SERVER_VERSION | awk -F ' ' '{ print $4 }') + +# Safety check +if echo $SERVER_VERSION | grep '^10.0' > /dev/null +then + # Check if binary logging is enabled on the Joiner node. If it is enabled, + # RESET MASTER needs to be executed on the Joiner node. Also, mysqldump + # should be executed with additional 'galera-sst-mode' option so that it + # adds a command to set gtid_binlog_state with that of Donor node in the + # dump, to be executed on the Joiner. + if [[ "$LOG_BIN" == 'ON' ]]; then + # Reset master for 10.0 to clear gtid state. + RESET_MASTER="RESET MASTER;" + # Set the galera-sst-mode option for mysqldump. + OPT_GALERA_SST_MODE="--galera-sst-mode" + fi +fi + +# NOTE: we don't use --routines here because we're dumping mysql.proc table +MYSQLDUMP="mysqldump $AUTH -S$WSREP_SST_OPT_SOCKET \ +--add-drop-database --add-drop-table --skip-add-locks --create-options \ +--disable-keys --extended-insert --skip-lock-tables --quick --set-charset \ +--skip-comments --flush-privileges --all-databases $OPT_GALERA_SST_MODE" + # need to disable logging when loading the dump # reason is that dump contains ALTER TABLE for log tables, and # this causes an error if logging is enabled @@ -118,9 +145,6 @@ $MYSQL -e"$STOP_WSREP SET GLOBAL SLOW_QUERY_LOG=OFF" RESTORE_GENERAL_LOG="SET GLOBAL GENERAL_LOG=$GENERAL_LOG_OPT;" RESTORE_SLOW_QUERY_LOG="SET GLOBAL SLOW_QUERY_LOG=$SLOW_LOG_OPT;" -# reset master for 10.0 to clear gtid state -RESET_MASTER="RESET MASTER;" - if [ $WSREP_SST_OPT_BYPASS -eq 0 ] then |