diff --git a/sql/log.cc b/sql/log.cc index 0e0a79d4558..9f724534e6e 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -5838,10 +5838,10 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional, /* Ensure that all events in a GTID group are in the same cache */ if (variables.option_bits & OPTION_GTID_BEGIN) is_transactional= 1; - + /* Pre-conditions */ DBUG_ASSERT(is_current_stmt_binlog_format_row()); - DBUG_ASSERT(WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()); + DBUG_ASSERT(WSREP_EMULATE_BINLOG_NNULL(this) || mysql_bin_log.is_open()); DBUG_ASSERT(table->s->table_map_id != ULONG_MAX); Table_map_log_event @@ -10769,7 +10769,7 @@ bool wsrep_stmt_rollback_is_safe(THD* thd) trx_cache->get_prev_position() < thd->wsrep_sr().bytes_certified())) { WSREP_DEBUG("statement rollback is not safe for streaming replication" - " pre-stmt_pos: %llu, frag repl pos: %lu\n" + " pre-stmt_pos: %llu, frag repl pos: %zu\n" "Thread: %llu, SQL: %s", trx_cache->get_prev_position(), thd->wsrep_sr().bytes_certified(), diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index 5377afc8228..8583897e064 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -141,7 +141,7 @@ extern "C" void wsrep_handle_SR_rollback(THD *bf_thd, DBUG_ASSERT(victim_thd); if (!victim_thd || !wsrep_on(bf_thd)) return; - WSREP_DEBUG("handle rollback, for deadlock: thd %llu trx_id %lu frags %lu conf %s", + WSREP_DEBUG("handle rollback, for deadlock: thd %llu trx_id %" PRIu64 " frags %zu conf %s", victim_thd->thread_id, victim_thd->wsrep_trx_id(), victim_thd->wsrep_sr().fragments_certified(), diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 92e0796da76..5b32cf6598b 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1663,10 +1663,10 @@ THD::~THD() THD is not deleted while they access it. The following mutex_lock ensures that no one else is using this THD and it's now safe to delete */ - if (WSREP(this)) mysql_mutex_lock(&LOCK_thd_data); + if (WSREP_NNULL(this)) mysql_mutex_lock(&LOCK_thd_data); mysql_mutex_lock(&LOCK_thd_kill); mysql_mutex_unlock(&LOCK_thd_kill); - if (WSREP(this)) mysql_mutex_unlock(&LOCK_thd_data); + if (WSREP_NNULL(this)) mysql_mutex_unlock(&LOCK_thd_data); if (!free_connection_done) free_connection(); @@ -1858,7 +1858,7 @@ void THD::awake_no_mutex(killed_state state_to_set) DBUG_PRINT("enter", ("this: %p current_thd: %p state: %d", this, current_thd, (int) state_to_set)); THD_CHECK_SENTRY(this); - if (WSREP(this)) mysql_mutex_assert_owner(&LOCK_thd_data); + if (WSREP_NNULL(this)) mysql_mutex_assert_owner(&LOCK_thd_data); mysql_mutex_assert_owner(&LOCK_thd_kill); print_aborted_warning(3, "KILLED"); @@ -6348,7 +6348,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) 5. Error: Cannot modify table that uses a storage engine limited to row-logging when binlog_format = STATEMENT */ - if (IF_WSREP((!WSREP(this) || + if (IF_WSREP((!WSREP_NNULL(this) || wsrep_cs().mode() == wsrep::client_state::m_local),1)) { my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), ""); @@ -6700,8 +6700,9 @@ int THD::binlog_write_row(TABLE* table, bool is_trans, uchar const *record) { - DBUG_ASSERT(is_current_stmt_binlog_format_row() && - ((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open())); + DBUG_ASSERT(is_current_stmt_binlog_format_row()); + DBUG_ASSERT((WSREP_NNULL(this) && wsrep_emulate_bin_log) || + mysql_bin_log.is_open()); /* Pack records into format for transfer. We are allocating more memory than needed, but that doesn't matter. @@ -6741,8 +6742,9 @@ int THD::binlog_update_row(TABLE* table, bool is_trans, const uchar *before_record, const uchar *after_record) { - DBUG_ASSERT(is_current_stmt_binlog_format_row() && - ((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open())); + DBUG_ASSERT(is_current_stmt_binlog_format_row()); + DBUG_ASSERT((WSREP_NNULL(this) && wsrep_emulate_bin_log) || + mysql_bin_log.is_open()); /** Save a reference to the original read bitmaps @@ -6820,8 +6822,9 @@ int THD::binlog_update_row(TABLE* table, bool is_trans, int THD::binlog_delete_row(TABLE* table, bool is_trans, uchar const *record) { - DBUG_ASSERT(is_current_stmt_binlog_format_row() && - ((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open())); + DBUG_ASSERT(is_current_stmt_binlog_format_row()); + DBUG_ASSERT((WSREP_NNULL(this) && wsrep_emulate_bin_log) || + mysql_bin_log.is_open()); /** Save a reference to the original read bitmaps We will need this to restore the bitmaps at the end as @@ -6952,7 +6955,7 @@ int THD::binlog_remove_pending_rows_event(bool clear_maps, { DBUG_ENTER("THD::binlog_remove_pending_rows_event"); - if(!WSREP_EMULATE_BINLOG(this) && !mysql_bin_log.is_open()) + if(!WSREP_EMULATE_BINLOG_NNULL(this) && !mysql_bin_log.is_open()) DBUG_RETURN(0); /* Ensure that all events in a GTID group are in the same cache */ @@ -6975,7 +6978,7 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional) mode: it might be the case that we left row-based mode before flushing anything (e.g., if we have explicitly locked tables). */ - if(!WSREP_EMULATE_BINLOG(this) && !mysql_bin_log.is_open()) + if (!WSREP_EMULATE_BINLOG_NNULL(this) && !mysql_bin_log.is_open()) DBUG_RETURN(0); /* Ensure that all events in a GTID group are in the same cache */ @@ -7248,7 +7251,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, show_query_type(qtype), (int) query_len, query_arg)); DBUG_ASSERT(query_arg); - DBUG_ASSERT(WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open()); + DBUG_ASSERT(WSREP_EMULATE_BINLOG_NNULL(this) || mysql_bin_log.is_open()); /* If this is withing a BEGIN ... COMMIT group, don't log it */ if (variables.option_bits & OPTION_GTID_BEGIN) diff --git a/sql/sql_class.h b/sql/sql_class.h index cd4626ebc4e..1078484cfac 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4550,7 +4550,7 @@ public: { query_id= new_query_id; #ifdef WITH_WSREP - if (WSREP(this)) + if (WSREP_NNULL(this)) { set_wsrep_next_trx_id(query_id); WSREP_DEBUG("assigned new next trx id: %" PRIu64, wsrep_next_trx_id()); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 9f02a809026..77a83f2de45 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4599,7 +4599,7 @@ bool select_create::send_eof() wsrep_start_transaction(thd, thd->wsrep_next_trx_id()); } DBUG_ASSERT(thd->wsrep_trx_id() != WSREP_UNDEFINED_TRX_ID); - WSREP_DEBUG("CTAS key append for trx: %lu thd %llu query %lld ", + WSREP_DEBUG("CTAS key append for trx: %" PRIu64 " thd %llu query %lld ", thd->wsrep_trx_id(), thd->thread_id, thd->query_id); /* diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 831c2954e20..2da704d9b17 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7682,7 +7682,7 @@ void THD::reset_for_next_command(bool do_clear_error) use autoinc values passed in binlog events, not the values forced by the cluster. */ - if (WSREP(this) && wsrep_thd_is_local(this) && + if (WSREP_NNULL(this) && wsrep_thd_is_local(this) && !slave_thread && wsrep_auto_increment_control) { variables.auto_increment_offset= diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc index ad94aecb6b4..ef9dd872075 100644 --- a/sql/wsrep_notify.cc +++ b/sql/wsrep_notify.cc @@ -49,7 +49,7 @@ void wsrep_notify_status(enum wsrep::server_state::state status, " --primary %s", view->view_seqno().get() >= 0 ? "yes" : "no"); cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, - " --index %ld", view->own_index()); + " --index %zd", view->own_index()); const std::vector& members(view->members()); if (members.size())