diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 09524fedcc0..7db2a5605e1 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -227,7 +227,7 @@ wsrep_recover_position() { log_notice "WSREP: Running position recovery with --log_error=$wr_logfile" - $mysqld_cmd --log_error=$wr_logfile --wsrep-recover + eval_log_error $mysqld_cmd --log_error=$wr_logfile --wsrep-recover local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)" if [ -z "$rp" ]; then diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 5c292465ecc..017f4877fd6 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -91,7 +91,7 @@ wsrep_log() # echo everything to stderr so that it gets into common error log # deliberately made to look different from the rest of the log local readonly tst="$(date +%Y%m%d\ %H:%M:%S.%N | cut -b -21)" - echo "WSREP_SST: $* ($tst)" >>/dev/stderr + echo "WSREP_SST: $* ($tst)" >&2 } wsrep_log_error() diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index 120533edc4e..4434792240d 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -38,12 +38,12 @@ local_ip() return 1 } -if test -z "$WSREP_SST_OPT_USER"; then err "USER cannot be nil"; exit $EINVAL; fi -if test -z "$WSREP_SST_OPT_HOST"; then err "HOST cannot be nil"; exit $EINVAL; fi -if test -z "$WSREP_SST_OPT_PORT"; then err "PORT cannot be nil"; exit $EINVAL; fi -if test -z "$WSREP_SST_OPT_LPORT"; then err "LPORT cannot be nil"; exit $EINVAL; fi -if test -z "$WSREP_SST_OPT_SOCKET";then err "SOCKET cannot be nil";exit $EINVAL; fi -if test -z "$WSREP_SST_OPT_GTID"; then err "GTID cannot be nil"; exit $EINVAL; fi +if test -z "$WSREP_SST_OPT_USER"; then wsrep_log_error "USER cannot be nil"; exit $EINVAL; fi +if test -z "$WSREP_SST_OPT_HOST"; then wsrep_log_error "HOST cannot be nil"; exit $EINVAL; fi +if test -z "$WSREP_SST_OPT_PORT"; then wsrep_log_error "PORT cannot be nil"; exit $EINVAL; fi +if test -z "$WSREP_SST_OPT_LPORT"; then wsrep_log_error "LPORT cannot be nil"; exit $EINVAL; fi +if test -z "$WSREP_SST_OPT_SOCKET";then wsrep_log_error "SOCKET cannot be nil";exit $EINVAL; fi +if test -z "$WSREP_SST_OPT_GTID"; then wsrep_log_error "GTID cannot be nil"; exit $EINVAL; fi if local_ip $WSREP_SST_OPT_HOST && \ [ "$WSREP_SST_OPT_PORT" = "$WSREP_SST_OPT_LPORT" ] @@ -57,7 +57,7 @@ fi if ! mysql --version | grep 'Distrib 5.5' >/dev/null then mysql --version >&2 - err "this operation requires MySQL client version 5.5.x" + wsrep_log_error "this operation requires MySQL client version 5.5.x" exit $EINVAL fi diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 7cbfd8cbcdb..583d70fda5e 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -32,7 +32,7 @@ cleanup_joiner() rm -rf "$RSYNC_CONF" rm -rf "$MAGIC_FILE" rm -rf "$RSYNC_PID" - echo " done." >&2 + wsrep_log_info "Joiner cleanup done." } check_pid() diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh index 08cd221c2a2..f9bddd7bd4e 100644 --- a/scripts/wsrep_sst_xtrabackup.sh +++ b/scripts/wsrep_sst_xtrabackup.sh @@ -98,16 +98,9 @@ then if [ $WSREP_SST_OPT_BYPASS -eq 0 ] then - TMPDIR=${TMPDIR:-""} - if [ -z "${TMPDIR}" ]; then - # try to get it from my.cnf - TMPDIR=$(grep -E '^\s*tmpdir' $WSREP_SST_OPT_CONF | \ - awk -F = '{ print $2 }' | sed 's/^\s//g' | sed 's/\s.*//g' ) - # if failed default to /tmp - [ -z "${TMPDIR}" ] && TMPDIR="/tmp" - fi + TMPDIR=${TMPDIR:-"/tmp"} - INNOBACKUPEX_ARGS="--galera-info --tmpdir=${TMPDIR} --stream=tar + INNOBACKUPEX_ARGS="--galera-info --stream=tar --defaults-file=${WSREP_SST_OPT_CONF} --socket=${WSREP_SST_OPT_SOCKET}" diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 4414a077df8..c68d4dc16a4 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -1073,6 +1073,8 @@ bool Optimize_table_statement::execute(THD *thd) FALSE, UINT_MAX, FALSE)) goto error; /* purecov: inspected */ thd->enable_slow_log= opt_log_slow_admin_statements; + + WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL) res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ? mysql_recreate_table(thd, first_table) : mysql_admin_table(thd, first_table, &m_lex->check_opt, @@ -1104,6 +1106,7 @@ bool Repair_table_statement::execute(THD *thd) FALSE, UINT_MAX, FALSE)) goto error; /* purecov: inspected */ thd->enable_slow_log= opt_log_slow_admin_statements; + WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL) res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "repair", TL_WRITE, 1, test(m_lex->check_opt.sql_flags & TT_USEFRM), diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index d374244a205..4f080235069 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3658,7 +3658,8 @@ bool select_insert::send_eof() trans_table, table->file->table_type())); #ifdef WITH_WSREP - error= (thd->wsrep_conflict_state == MUST_ABORT) ? -1 : + error= (thd->wsrep_conflict_state == MUST_ABORT || + thd->wsrep_conflict_state == CERT_FAILURE) ? -1 : (thd->locked_tables_mode <= LTM_LOCK_TABLES ? table->file->ha_end_bulk_insert() : 0); #else @@ -4249,6 +4250,18 @@ bool select_create::send_eof() { trans_commit_stmt(thd); trans_commit_implicit(thd); +#ifdef WITH_WSREP + mysql_mutex_lock(&thd->LOCK_wsrep_thd); + if (thd->wsrep_conflict_state != NO_CONFLICT) + { + WSREP_DEBUG("select_create commit failed, thd: %lu err: %d %s", + thd->thread_id, thd->wsrep_conflict_state, thd->query()); + mysql_mutex_unlock(&thd->LOCK_wsrep_thd); + abort_result_set(); + return TRUE; + } + mysql_mutex_unlock(&thd->LOCK_wsrep_thd); +#endif /* WITH_WSREP */ } table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc index 576e6b8ad47..8b682d579d8 100644 --- a/sql/wsrep_hton.cc +++ b/sql/wsrep_hton.cc @@ -321,6 +321,7 @@ wsrep_run_wsrep_commit( { WSREP_DEBUG("empty rbr buffer, query: %s", thd->query()); } + thd->wsrep_query_state= QUERY_EXEC; DBUG_RETURN(WSREP_TRX_OK); } if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_trx_handle.trx_id) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 597d0ea087d..5aca1de6d0e 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -937,7 +937,7 @@ static int sst_donate_other (const char* method, { WSREP_ERROR("sst_donate_other(): pthread_create() failed: %d (%s)", ret, strerror(ret)); - return ret; + return -ret; } mysql_cond_wait (&arg.cond, &arg.lock); diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc index daba0e4cab2..392fb65d82c 100644 --- a/sql/wsrep_utils.cc +++ b/sql/wsrep_utils.cc @@ -353,10 +353,8 @@ size_t guess_ip (char* buf, size_t buf_len) // try to find the address of the first one #if (TARGET_OS_LINUX == 1) - const char cmd[] = "/sbin/ifconfig | " -// "grep -m1 -1 -E '^[a-z]?eth[0-9]' | tail -n 1 | " - "grep -E '^[[:space:]]+inet addr:' | grep -m1 -v 'inet addr:127' | " - "sed 's/:/ /' | awk '{ print $3 }'"; + const char cmd[] = "ip addr show | grep -E '^\\s*inet' | grep -m1 global |" + " awk '{ print $2 }' | sed 's/\\/.*//'"; #elif defined(__sun__) const char cmd[] = "/sbin/ifconfig -a | " "/usr/gnu/bin/grep -m1 -1 -E 'net[0-9]:' | tail -n 1 | awk '{ print $2 }'"; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 3ed744382c7..f0ae2ff9f86 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4513,7 +4513,7 @@ wsrep_innobase_mysql_sort( memcpy(tmp_str, str, str_length); tmp_length = charset->coll->strnxfrm(charset, str, str_length, - tmp_str, tmp_length); + tmp_str, str_length); DBUG_ASSERT(tmp_length == str_length); break; diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index 4791100f555..853e65c8573 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -5666,6 +5666,11 @@ lock_rec_convert_impl_to_expl( implicit lock. Because cannot lock at this moment.*/ if (rec_get_deleted_flag(rec, rec_offs_comp(offsets)) +#ifdef WITH_WSREP + && !wsrep_thd_is_brute_force(impl_trx->mysql_thd) + /* BF-BF conflict is possible if advancing into + lock_rec_other_has_conflicting*/ +#endif /* WITH_WSREP */ && lock_rec_other_has_conflicting( LOCK_X | LOCK_REC_NOT_GAP, block, heap_no, impl_trx)) { diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 02ee941351e..a0f953a41f4 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -5176,7 +5176,7 @@ wsrep_innobase_mysql_sort( memcpy(tmp_str, str, str_length); tmp_length = charset->coll->strnxfrm(charset, str, str_length, - tmp_str, tmp_length); + tmp_str, str_length); DBUG_ASSERT(tmp_length == str_length); break; diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c index 3d97def3750..a38656200db 100644 --- a/storage/xtradb/lock/lock0lock.c +++ b/storage/xtradb/lock/lock0lock.c @@ -5691,6 +5691,11 @@ lock_rec_convert_impl_to_expl( implicit lock. Because cannot lock at this moment.*/ if (rec_get_deleted_flag(rec, rec_offs_comp(offsets)) +#ifdef WITH_WSREP + && !wsrep_thd_is_brute_force(impl_trx->mysql_thd) + /* BF-BF conflict is possible if advancing into + lock_rec_other_has_conflicting*/ +#endif /* WITH_WSREP */ && lock_rec_other_has_conflicting( LOCK_X | LOCK_REC_NOT_GAP, block, heap_no, impl_trx)) {