diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index f9ff1f5cf317e..a8a4d8299b3c0 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -32,7 +32,7 @@ MACRO (INSTALL_DSYM_DIRECTORIES targets) # It's a dirty hack, but cmake too stupid and mysql cmake files too buggy */ STRING(REPLACE "liblibmysql.dylib" "libmysqlclient.${SHARED_LIB_MAJOR_VERSION}.dylib" location ${location}) IF(type MATCHES "EXECUTABLE" OR type MATCHES "MODULE" OR type MATCHES "SHARED_LIBRARY") - INSTALL(DIRECTORY "${location}.dSYM" DESTINATION ${INSTALL_LOCATION} COMPONENT Debuginfo) + INSTALL(DIRECTORY "${location}.dSYM" DESTINATION ${ARG_DESTINATION} COMPONENT Debuginfo) ENDIF() ENDFOREACH() ENDIF() diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake index 608b33b31a1b4..6a4e9a2104950 100644 --- a/cmake/wsrep.cmake +++ b/cmake/wsrep.cmake @@ -17,7 +17,7 @@ # so WSREP_VERSION is produced regardless # Set the patch version -SET(WSREP_PATCH_VERSION "7.5") +SET(WSREP_PATCH_VERSION "7.6") # Obtain patch revision number SET(WSREP_PATCH_REVNO $ENV{WSREP_REV}) diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index cd65dcb96d51b..baaba48feb6a9 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1016,10 +1016,15 @@ The following options may be given as the first argument: --wsrep-dbug-option=name DBUG options to provider library --wsrep-debug To enable debug level logging + --wsrep-desync To desynchronize the node from the cluster --wsrep-drupal-282555-workaround To use a workaround forbad autoincrement value --wsrep-forced-binlog-format=name binlog format to take effect over user's choice + --wsrep-load-data-splitting + To commit LOAD DATA transaction after every 10K rows + inserted + (Defaults to on; use --skip-wsrep-load-data-splitting to disable.) --wsrep-log-conflicts To log multi-master conflicts --wsrep-max-ws-rows=# @@ -1360,8 +1365,10 @@ wsrep-convert-LOCK-to-trx FALSE wsrep-data-home-dir wsrep-dbug-option wsrep-debug FALSE +wsrep-desync FALSE wsrep-drupal-282555-workaround FALSE wsrep-forced-binlog-format NONE +wsrep-load-data-splitting TRUE wsrep-log-conflicts FALSE wsrep-max-ws-rows 131072 wsrep-max-ws-size 1073741824 @@ -1379,7 +1386,7 @@ wsrep-slave-threads 1 wsrep-sst-auth (No default value) wsrep-sst-donor wsrep-sst-donor-rejects-queries FALSE -wsrep-sst-method mysqldump +wsrep-sst-method rsync wsrep-sst-receive-address AUTO wsrep-start-position 00000000-0000-0000-0000-000000000000:-1 diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result index b61a8aabf0895..adfd9f3bbe6f1 100644 --- a/mysql-test/suite/sys_vars/r/all_vars.result +++ b/mysql-test/suite/sys_vars/r/all_vars.result @@ -20,8 +20,10 @@ wsrep_convert_lock_to_trx wsrep_data_home_dir wsrep_dbug_option wsrep_debug +wsrep_desync wsrep_drupal_282555_workaround wsrep_forced_binlog_format +wsrep_load_data_splitting wsrep_log_conflicts wsrep_max_ws_rows wsrep_max_ws_size diff --git a/mysys/my_default.c b/mysys/my_default.c index 5db1c44f6f2c4..ff87eb0a0f35f 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -112,15 +112,9 @@ static my_bool find_wsrep_new_cluster (int* argc, char* argv[]) { ret= TRUE; *argc -= 1; - if (*argc == i) - { // last argument, just zero it up - argv[i]= NULL; - } - else - { // not the last argument, copy the last one over and zero that up. - argv[i]= argv[*argc]; - argv[*argc]= NULL; - } + /* preserve the order of remaining arguments */ + memmove(&argv[i], &argv[i + 1], (*argc - i)*sizeof(argv[i])); + argv[*argc]= NULL; } } diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 1d41d7142f164..7d847cdaf796b 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -945,9 +945,6 @@ have_sleep=1 # maximum number of wsrep restarts max_wsrep_restarts=0 -# maximum number of wsrep restarts -max_wsrep_restarts=0 - while true do rm -f "$pid_file" # Some extra safety diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 7cd232e088774..b3535480c67a3 100755 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -67,6 +67,15 @@ check_pid_and_port() MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete" rm -rf "$MAGIC_FILE" +SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd -P) +WSREP_LOG_DIR=${WSREP_LOG_DIR:-$($SCRIPT_DIR/my_print_defaults --defaults-file "$WSREP_SST_OPT_CONF" mysqld server mysqld-5.5 \ + | grep -- '--innodb[-_]log[-_]group[-_]home[-_]dir=' | cut -b 29- )} +if [ -n "${WSREP_LOG_DIR:-""}" ]; then + WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; mkdir -p "$WSREP_LOG_DIR"; cd $WSREP_LOG_DIR; pwd -P) +else + WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; pwd -P) +fi + # Old filter - include everything except selected # FILTER=(--exclude '*.err' --exclude '*.pid' --exclude '*.sock' \ # --exclude '*.conf' --exclude core --exclude 'galera.*' \ @@ -74,9 +83,8 @@ rm -rf "$MAGIC_FILE" # --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') # New filter - exclude everything except dirs (schemas) and innodb files -FILTER=(-f '- lost+found' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /ib_logfile*' -f '+ */' -f '-! */*') -# Old versions of rsync have a bug transferring filter rules to daemon, so specify filter rules directly to daemon -FILTER_DAEMON="- lost+found + /ib_lru_dump + /ibdata* + ib_logfile* + */ -! */*" +FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' + -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*') if [ "$WSREP_SST_OPT_ROLE" = "donor" ] then @@ -107,54 +115,58 @@ then # first, the normal directories, so that we can detect incompatible protocol RC=0 - rsync --archive --no-times --ignore-times --inplace --delete --quiet \ - --no-recursive --dirs \ + rsync --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ $WHOLE_FILE_OPT "${FILTER[@]}" "$WSREP_SST_OPT_DATA/" \ - rsync://$WSREP_SST_OPT_ADDR-with_filter || RC=$? - - [ $RC -ne 0 ] && wsrep_log_error "rsync returned code $RC:" - - case $RC in - 0) RC=0 # Success - ;; - 12) RC=71 # EPROTO - wsrep_log_error \ - "rsync server on the other end has incompatible protocol. " \ - "Make sure you have the same version of rsync on all nodes." - ;; - 22) RC=12 # ENOMEM - ;; - *) RC=255 # unknown error - ;; - esac - - [ $RC -ne 0 ] && exit $RC + rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$? + + if [ "$RC" -ne 0 ]; then + wsrep_log_error "rsync returned code $RC:" + + case $RC in + 12) RC=71 # EPROTO + wsrep_log_error \ + "rsync server on the other end has incompatible protocol. " \ + "Make sure you have the same version of rsync on all nodes." + ;; + 22) RC=12 # ENOMEM + ;; + *) RC=255 # unknown error + ;; + esac + exit $RC + fi + + # second, we transfer InnoDB log files + rsync --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' -f '- **' "$WSREP_LOG_DIR/" \ + rsync://$WSREP_SST_OPT_ADDR-log_dir >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync innodb_log_group_home_dir returned code $RC:" + exit 255 # unknown error + fi # then, we parallelize the transfer of database directories, use . so that pathconcatenation works - pushd "$WSREP_SST_OPT_DATA" 1>/dev/null + pushd "$WSREP_SST_OPT_DATA" >/dev/null count=1 [ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo) [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu) find . -maxdepth 1 -mindepth 1 -type d -print0 | xargs -I{} -0 -P $count \ - rsync --archive --no-times --ignore-times --inplace --delete --quiet \ - $WHOLE_FILE_OPT "$WSREP_SST_OPT_DATA"/{}/ \ - rsync://$WSREP_SST_OPT_ADDR/{} || RC=$? - - popd 1>/dev/null + rsync --owner --group --perms --links --specials \ + --ignore-times --inplace --recursive --delete --quiet \ + $WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \ + rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$? - [ $RC -ne 0 ] && wsrep_log_error "find/rsync returned code $RC:" - - case $RC in - 0) RC=0 # Success - ;; - *) RC=255 # unknown error - ;; - esac - - [ $RC -ne 0 ] && exit $RC + popd >/dev/null + if [ $RC -ne 0 ]; then + wsrep_log_error "find/rsync returned code $RC:" + exit 255 # unknown error + fi else # BYPASS wsrep_log_info "Bypassing state dump." @@ -203,19 +215,14 @@ then cat << EOF > "$RSYNC_CONF" pid file = $RSYNC_PID use chroot = no -[$MODULE-with_filter] - path = $WSREP_SST_OPT_DATA - read only = no - timeout = 300 - uid = $MYUID - gid = $MYGID - filter = $FILTER_DAEMON +read only = no +timeout = 300 +uid = $MYUID +gid = $MYGID [$MODULE] path = $WSREP_SST_OPT_DATA - read only = no - timeout = 300 - uid = $MYUID - gid = $MYGID +[$MODULE-log_dir] + path = $WSREP_LOG_DIR EOF # rm -rf "$DATA"/ib_logfile* # we don't want old logs around diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8a9e8db53fbf8..48d3ab6a61143 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -738,6 +738,7 @@ wsrep_aborting_thd_t wsrep_aborting_thd= NULL; mysql_mutex_t LOCK_wsrep_replaying; mysql_cond_t COND_wsrep_replaying; mysql_mutex_t LOCK_wsrep_slave_threads; +mysql_mutex_t LOCK_wsrep_desync; int wsrep_replaying= 0; static void wsrep_close_threads(THD* thd); #endif @@ -881,7 +882,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list, PSI_mutex_key key_LOCK_wsrep_rollback, key_LOCK_wsrep_thd, key_LOCK_wsrep_replaying, key_LOCK_wsrep_ready, key_LOCK_wsrep_sst, key_LOCK_wsrep_sst_thread, key_LOCK_wsrep_sst_init, - key_LOCK_wsrep_slave_threads; + key_LOCK_wsrep_slave_threads, key_LOCK_wsrep_desync; #endif PSI_mutex_key key_RELAYLOG_LOCK_index; PSI_mutex_key key_LOCK_slave_state, key_LOCK_binlog_state; @@ -966,6 +967,7 @@ static PSI_mutex_info all_server_mutexes[]= { &key_LOCK_wsrep_thd, "THD::LOCK_wsrep_thd", 0}, { &key_LOCK_wsrep_replaying, "LOCK_wsrep_replaying", PSI_FLAG_GLOBAL}, { &key_LOCK_wsrep_slave_threads, "LOCK_wsrep_slave_threads", PSI_FLAG_GLOBAL}, + { &key_LOCK_wsrep_desync, "LOCK_wsrep_desync", PSI_FLAG_GLOBAL}, #endif { &key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL}, { &key_LOCK_thread_cache, "LOCK_thread_cache", PSI_FLAG_GLOBAL}, @@ -2217,6 +2219,7 @@ static void clean_up_mutexes() (void) mysql_mutex_destroy(&LOCK_wsrep_replaying); (void) mysql_cond_destroy(&COND_wsrep_replaying); (void) mysql_mutex_destroy(&LOCK_wsrep_slave_threads); + (void) mysql_mutex_destroy(&LOCK_wsrep_desync); #endif mysql_mutex_destroy(&LOCK_server_started); mysql_cond_destroy(&COND_server_started); @@ -4482,6 +4485,8 @@ static int init_thread_environment() mysql_cond_init(key_COND_wsrep_replaying, &COND_wsrep_replaying, NULL); mysql_mutex_init(key_LOCK_wsrep_slave_threads, &LOCK_wsrep_slave_threads, MY_MUTEX_INIT_FAST); + mysql_mutex_init(key_LOCK_wsrep_desync, + &LOCK_wsrep_desync, MY_MUTEX_INIT_FAST); #endif DBUG_RETURN(0); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index fada891299c83..2ecdf7cbdfb2e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2656,7 +2656,11 @@ mysql_execute_command(THD *thd) thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd); /* Commit the normal transaction if one is active. */ if (trans_commit_implicit(thd)) + { + thd->mdl_context.release_transactional_locks(); + WSREP_DEBUG("implicit commit failed, MDL released: %lu", thd->thread_id); goto error; + } /* Release metadata locks acquired in this transaction. */ thd->mdl_context.release_transactional_locks(); } @@ -4588,7 +4592,11 @@ case SQLCOM_PREPARE: case SQLCOM_BEGIN: if (trans_begin(thd, lex->start_transaction_opt)) + { + thd->mdl_context.release_transactional_locks(); + WSREP_DEBUG("BEGIN failed, MDL released: %lu", thd->thread_id); goto error; + } my_ok(thd); break; case SQLCOM_COMMIT: @@ -4602,7 +4610,11 @@ case SQLCOM_PREPARE: (thd->variables.completion_type == 2 && lex->tx_release != TVL_NO)); if (trans_commit(thd)) + { + thd->mdl_context.release_transactional_locks(); + WSREP_DEBUG("COMMIT failed, MDL released: %lu", thd->thread_id); goto error; + } thd->mdl_context.release_transactional_locks(); /* Begin transaction with the same isolation level. */ if (tx_chain) @@ -4636,7 +4648,11 @@ case SQLCOM_PREPARE: (thd->variables.completion_type == 2 && lex->tx_release != TVL_NO)); if (trans_rollback(thd)) + { + thd->mdl_context.release_transactional_locks(); + WSREP_DEBUG("rollback failed, MDL released: %lu", thd->thread_id); goto error; + } thd->mdl_context.release_transactional_locks(); /* Begin transaction with the same isolation level. */ if (tx_chain) @@ -5181,7 +5197,11 @@ case SQLCOM_PREPARE: break; case SQLCOM_XA_COMMIT: if (trans_xa_commit(thd)) + { + thd->mdl_context.release_transactional_locks(); + WSREP_DEBUG("XA commit failed, MDL released: %lu", thd->thread_id); goto error; + } thd->mdl_context.release_transactional_locks(); /* We've just done a commit, reset transaction @@ -5193,7 +5213,11 @@ case SQLCOM_PREPARE: break; case SQLCOM_XA_ROLLBACK: if (trans_xa_rollback(thd)) + { + thd->mdl_context.release_transactional_locks(); + WSREP_DEBUG("XA rollback failed, MDL released: %lu", thd->thread_id); goto error; + } thd->mdl_context.release_transactional_locks(); /* We've just done a rollback, reset transaction diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index cb64624cc3d38..00be8bfbc2153 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2971,6 +2971,8 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type) if (trans_commit_stmt(thd) || trans_commit(thd)) { thd->variables.option_bits&= ~OPTION_AUTOCOMMIT; + thd->mdl_context.release_transactional_locks(); + WSREP_DEBUG("autocommit, MDL TRX lock released: %lu", thd->thread_id); return true; } /* @@ -4253,6 +4255,15 @@ static Sys_var_enum Sys_wsrep_OSU_method( NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0)); +static PolyLock_mutex PLock_wsrep_desync(&LOCK_wsrep_desync); +static Sys_var_mybool Sys_wsrep_desync ( + "wsrep_desync", "To desynchronize the node from the cluster", + GLOBAL_VAR(wsrep_desync), + CMD_LINE(OPT_ARG), DEFAULT(FALSE), + &PLock_wsrep_desync, NOT_IN_BINLOG, + ON_CHECK(wsrep_desync_check), + ON_UPDATE(wsrep_desync_update)); + static Sys_var_enum Sys_wsrep_forced_binlog_format( "wsrep_forced_binlog_format", "binlog format to take effect over user's choice", GLOBAL_VAR(wsrep_forced_binlog_format), diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc index bd934031fc351..3756f54ab48d9 100644 --- a/sql/wsrep_hton.cc +++ b/sql/wsrep_hton.cc @@ -331,9 +331,17 @@ wsrep_run_wsrep_commit( } if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_trx_handle.trx_id) { - WSREP_WARN("SQL statement was ineffective: %s\n => Skipping replication", thd->query()); - } - else if (!rcode) + WSREP_WARN("SQL statement was ineffective, THD: %lu, buf: %d\n" + "QUERY: %s\n" + " => Skipping replication", + thd->thread_id, data_len, thd->query()); + if (wsrep_debug) + { + wsrep_write_rbr_buf(thd, rbr_data, data_len); + } + rcode = WSREP_TRX_FAIL; + } + else if (!rcode) { rcode = wsrep->pre_commit( wsrep, @@ -343,13 +351,14 @@ wsrep_run_wsrep_commit( data_len, (thd->wsrep_PA_safe) ? WSREP_FLAG_PA_SAFE : 0ULL, &thd->wsrep_trx_seqno); - if (rcode == WSREP_TRX_MISSING) { + switch (rcode) { + case WSREP_TRX_MISSING: WSREP_WARN("Transaction missing in provider, thd: %ld, SQL: %s", thd->thread_id, thd->query()); wsrep_write_rbr_buf(thd, rbr_data, data_len); - rcode = WSREP_OK; - } else if (rcode == WSREP_BF_ABORT) { + break; + case WSREP_BF_ABORT: mysql_mutex_lock(&thd->LOCK_wsrep_thd); thd->wsrep_conflict_state = MUST_REPLAY; mysql_mutex_unlock(&thd->LOCK_wsrep_thd); @@ -358,8 +367,11 @@ wsrep_run_wsrep_commit( WSREP_DEBUG("replaying increased: %d, thd: %lu", wsrep_replaying, thd->thread_id); mysql_mutex_unlock(&LOCK_wsrep_replaying); + break; + default: + thd->wsrep_seqno_changed = true; + break; } - thd->wsrep_seqno_changed = true; } else { WSREP_ERROR("I/O error reading from thd's binlog iocache: " "errno=%d, io cache code=%d", my_errno, cache->error); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 4cf7fb38b81c6..2196a7b050cf1 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -50,6 +50,7 @@ my_bool wsrep_replicate_myisam = 0; // enable myisam replication my_bool wsrep_log_conflicts = 0; // ulong wsrep_mysql_replication_bundle = 0; my_bool wsrep_load_data_splitting = 1; // commit load data every 10K intervals +my_bool wsrep_desync = 0; // desynchronize the node from the cluster /* * End configuration options diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 33fbf2f3bff44..607014e3fa987 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -93,6 +93,7 @@ extern long wsrep_max_protocol_version; extern long wsrep_protocol_version; extern ulong wsrep_forced_binlog_format; extern ulong wsrep_OSU_method_options; +extern my_bool wsrep_desync; extern my_bool wsrep_recovery; extern my_bool wsrep_replicate_myisam; extern my_bool wsrep_log_conflicts; @@ -173,6 +174,9 @@ extern bool wsrep_sst_donor_update UPDATE_ARGS; extern bool wsrep_slave_threads_check CHECK_ARGS; extern bool wsrep_slave_threads_update UPDATE_ARGS; +extern bool wsrep_desync_check CHECK_ARGS; +extern bool wsrep_desync_update UPDATE_ARGS; + extern bool wsrep_before_SE(); // initialize wsrep before storage // engines (true) or after (false) extern int wsrep_init(); @@ -349,6 +353,7 @@ extern long wsrep_max_ws_rows; extern int wsrep_to_isolation; extern my_bool wsrep_certify_nonPK; extern mysql_mutex_t LOCK_wsrep_slave_threads; +extern mysql_mutex_t LOCK_wsrep_desync; extern PSI_mutex_key key_LOCK_wsrep_ready; extern PSI_mutex_key key_COND_wsrep_ready; @@ -363,6 +368,7 @@ extern PSI_cond_key key_COND_wsrep_rollback; extern PSI_mutex_key key_LOCK_wsrep_replaying; extern PSI_cond_key key_COND_wsrep_replaying; extern PSI_mutex_key key_LOCK_wsrep_slave_threads; +extern PSI_mutex_key key_LOCK_wsrep_desync; struct TABLE_LIST; int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc index 19ffb1018415a..53d0f7c449efd 100644 --- a/sql/wsrep_utils.cc +++ b/sql/wsrep_utils.cc @@ -359,7 +359,7 @@ size_t guess_ip (char* buf, size_t buf_len) const char cmd[] = "/sbin/ifconfig -a | " "/usr/gnu/bin/grep -m1 -1 -E 'net[0-9]:' | tail -n 1 | awk '{ print $2 }'"; #elif defined(__APPLE__) || defined(__FreeBSD__) - const char cmd[] = "route -nv get 8.8.8.8 | tail -n1 | awk '{print $5}'"; + const char cmd[] = "/sbin/route -nv get 8.8.8.8 | tail -n1 | awk '{print $(NF)}'"; #else char *cmd; #error "OS not supported" diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 8fa8137633793..94ac902506f02 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -470,6 +470,45 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) } return false; } + +bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var) +{ + bool new_wsrep_desync = var->value->val_bool(); + if (wsrep_desync == new_wsrep_desync) { + if (new_wsrep_desync) { + push_warning (thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_VAR, + "'wsrep_desync' is already ON."); + } else { + push_warning (thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WRONG_VALUE_FOR_VAR, + "'wsrep_desync' is already OFF."); + } + } + return 0; +} + +bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type) +{ + wsrep_status_t ret(WSREP_WARNING); + if (wsrep_desync) { + ret = wsrep->desync (wsrep); + if (ret != WSREP_OK) { + WSREP_WARN ("SET desync failed %d for %s", ret, thd->query()); + my_error (ER_CANNOT_USER, MYF(0), "'desync'", thd->query()); + return true; + } + } else { + ret = wsrep->resync (wsrep); + if (ret != WSREP_OK) { + WSREP_WARN ("SET resync failed %d for %s", ret, thd->query()); + my_error (ER_CANNOT_USER, MYF(0), "'resync'", thd->query()); + return true; + } + } + return false; +} + /* * Status variables stuff below */ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 8ccc8dd3a6a93..fa434f99da60f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -9266,8 +9266,10 @@ wsrep_append_foreign_key( UT_LIST_GET_FIRST(foreign->foreign_table->indexes); int i = 0; while (idx != NULL && idx != idx_target) { + if (innobase_strcasecmp (idx->name, innobase_index_reserve_name) != 0) { + i++; + } idx = UT_LIST_GET_NEXT(indexes, idx); - i++; } ut_a(idx); key[0] = (char)i; diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 25e8c893dda22..a8ba8dbc1f329 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -8354,8 +8354,10 @@ wsrep_append_foreign_key( UT_LIST_GET_FIRST(foreign->foreign_table->indexes); int i = 0; while (idx != NULL && idx != idx_target) { + if (innobase_strcasecmp (idx->name, innobase_index_reserve_name) != 0) { + i++; + } idx = UT_LIST_GET_NEXT(indexes, idx); - i++; } ut_a(idx); key[0] = (char)i; diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index e8d00fee542d3..2b4577377e841 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -417,6 +417,8 @@ case "$mode" in fi exit $r ;; + 'bootstrap') + echo $echo_n "Bootstrapping the cluster" *) # usage basename=`basename "$0"`