diff options
-rwxr-xr-x | scripts/wsrep_sst_rsync | 109 | ||||
-rw-r--r-- | sql/wsrep_hton.cc | 12 | ||||
-rw-r--r-- | sql/wsrep_mysqld.cc | 6 | ||||
-rw-r--r-- | sql/wsrep_mysqld.h | 3 | ||||
-rw-r--r-- | sql/wsrep_sst.cc | 4 | ||||
-rw-r--r-- | sql/wsrep_var.cc | 4 |
6 files changed, 73 insertions, 65 deletions
diff --git a/scripts/wsrep_sst_rsync b/scripts/wsrep_sst_rsync index 7cd232e0887..b3535480c67 100755 --- a/scripts/wsrep_sst_rsync +++ b/scripts/wsrep_sst_rsync @@ -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/wsrep_hton.cc b/sql/wsrep_hton.cc index 3756f54ab48..5ac4a5fad12 100644 --- a/sql/wsrep_hton.cc +++ b/sql/wsrep_hton.cc @@ -49,7 +49,7 @@ void wsrep_cleanup_transaction(THD *thd) { DBUG_PRINT("wsrep", ("set committed fail")); WSREP_WARN("set committed fail: %llu %d", - (long long)thd->real_id, thd->stmt_da->status()); + (long long)thd->real_id, thd->get_stmt_da()->status()); } } //else @@ -194,9 +194,9 @@ wsrep_run_wsrep_commit( IO_CACHE *cache; int replay_round= 0; - if (thd->stmt_da->is_error()) { + if (thd->get_stmt_da()->is_error()) { WSREP_ERROR("commit issue, error: %d %s", - thd->stmt_da->sql_errno(), thd->stmt_da->message()); + thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message()); } DBUG_ENTER("wsrep_run_wsrep_commit"); @@ -308,8 +308,8 @@ wsrep_run_wsrep_commit( mysql_mutex_lock(&thd->LOCK_wsrep_thd); thd->wsrep_exec_mode = LOCAL_COMMIT; mysql_mutex_unlock(&thd->LOCK_wsrep_thd); - if (thd->stmt_da->is_ok() && - thd->stmt_da->affected_rows() > 0 && + if (thd->get_stmt_da()->is_ok() && + thd->get_stmt_da()->affected_rows() > 0 && !binlog_filter->is_on()) { WSREP_DEBUG("empty rbr buffer, query: %s, " @@ -317,7 +317,7 @@ wsrep_run_wsrep_commit( "changed tables: %d, " "sql_log_bin: %d, " "wsrep status (%d %d %d)", - thd->query(), thd->stmt_da->affected_rows(), + thd->query(), thd->get_stmt_da()->affected_rows(), stmt_has_updated_trans_table(thd), thd->variables.sql_log_bin, thd->wsrep_exec_mode, thd->wsrep_query_state, thd->wsrep_conflict_state); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 14bc3e54845..2b19b07cc2a 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -571,7 +571,7 @@ int wsrep_init() return rcode; } -extern "C" int wsrep_on(void *); +extern int wsrep_on(void *); void wsrep_init_startup (bool first) { @@ -1284,10 +1284,10 @@ void wsrep_to_isolation_end(THD *thd) { msg, \ req->thread_id, (long long)req->wsrep_trx_seqno, \ req->wsrep_exec_mode, req->wsrep_query_state, req->wsrep_conflict_state, \ - req->command, req->lex->sql_command, req->query(), \ + req->get_command(), req->lex->sql_command, req->query(), \ gra->thread_id, (long long)gra->wsrep_trx_seqno, \ gra->wsrep_exec_mode, gra->wsrep_query_state, gra->wsrep_conflict_state, \ - gra->command, gra->lex->sql_command, gra->query()); + gra->get_command(), gra->lex->sql_command, gra->query()); bool wsrep_grant_mdl_exception(MDL_context *requestor_ctx, diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 607014e3fa9..df33aa178e5 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -317,7 +317,8 @@ void wsrep_rollback_process(THD *thd); void wsrep_brute_force_killer(THD *thd); int wsrep_hire_brute_force_killer(THD *thd, uint64_t trx_id); extern "C" bool wsrep_consistency_check(void *thd_ptr); -extern "C" int wsrep_thd_is_brute_force(void *thd_ptr); +//extern "C" int wsrep_thd_is_brute_force(void *thd_ptr); +extern int wsrep_thd_is_brute_force(void *thd_ptr); extern "C" int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal); extern "C" int wsrep_thd_in_locking_session(void *thd_ptr); diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 204a937ea8f..4afe269cfe2 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -725,9 +725,9 @@ static int run_sql_command(THD *thd, const char *query) mysql_parse(thd, thd->query(), thd->query_length(), &ps); if (thd->is_error()) { - int const err= thd->stmt_da->sql_errno(); + int const err= thd->get_stmt_da()->sql_errno(); WSREP_WARN ("error executing '%s': %d (%s)%s", - query, err, thd->stmt_da->message(), + query, err, thd->get_stmt_da()->message(), err == ER_UNKNOWN_SYSTEM_VARIABLE ? ". Was mysqld built with --with-innodb-disallow-writes ?" : ""); thd->clear_error(); diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 94ac902506f..17e8de9ba6b 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -476,11 +476,11 @@ 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, + push_warning (thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_VALUE_FOR_VAR, "'wsrep_desync' is already ON."); } else { - push_warning (thd, MYSQL_ERROR::WARN_LEVEL_WARN, + push_warning (thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_VALUE_FOR_VAR, "'wsrep_desync' is already OFF."); } |