1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fix -Wformat and -Wnonnull-compare for WSREP

This commit is contained in:
Marko Mäkelä
2019-04-03 09:19:12 +03:00
parent 0dc442ac61
commit b896f60a73
7 changed files with 24 additions and 21 deletions

View File

@ -5841,7 +5841,7 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
/* Pre-conditions */ /* Pre-conditions */
DBUG_ASSERT(is_current_stmt_binlog_format_row()); 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); DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
Table_map_log_event 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())) trx_cache->get_prev_position() < thd->wsrep_sr().bytes_certified()))
{ {
WSREP_DEBUG("statement rollback is not safe for streaming replication" 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", "Thread: %llu, SQL: %s",
trx_cache->get_prev_position(), trx_cache->get_prev_position(),
thd->wsrep_sr().bytes_certified(), thd->wsrep_sr().bytes_certified(),

View File

@ -141,7 +141,7 @@ extern "C" void wsrep_handle_SR_rollback(THD *bf_thd,
DBUG_ASSERT(victim_thd); DBUG_ASSERT(victim_thd);
if (!victim_thd || !wsrep_on(bf_thd)) return; 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->thread_id,
victim_thd->wsrep_trx_id(), victim_thd->wsrep_trx_id(),
victim_thd->wsrep_sr().fragments_certified(), victim_thd->wsrep_sr().fragments_certified(),

View File

@ -1663,10 +1663,10 @@ THD::~THD()
THD is not deleted while they access it. The following mutex_lock 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 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_lock(&LOCK_thd_kill);
mysql_mutex_unlock(&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) if (!free_connection_done)
free_connection(); 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", DBUG_PRINT("enter", ("this: %p current_thd: %p state: %d",
this, current_thd, (int) state_to_set)); this, current_thd, (int) state_to_set));
THD_CHECK_SENTRY(this); 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); mysql_mutex_assert_owner(&LOCK_thd_kill);
print_aborted_warning(3, "KILLED"); 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 5. Error: Cannot modify table that uses a storage engine
limited to row-logging when binlog_format = STATEMENT 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)) wsrep_cs().mode() == wsrep::client_state::m_local),1))
{ {
my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), ""); 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) uchar const *record)
{ {
DBUG_ASSERT(is_current_stmt_binlog_format_row() && DBUG_ASSERT(is_current_stmt_binlog_format_row());
((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open())); DBUG_ASSERT((WSREP_NNULL(this) && wsrep_emulate_bin_log) ||
mysql_bin_log.is_open());
/* /*
Pack records into format for transfer. We are allocating more Pack records into format for transfer. We are allocating more
memory than needed, but that doesn't matter. 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 *before_record,
const uchar *after_record) const uchar *after_record)
{ {
DBUG_ASSERT(is_current_stmt_binlog_format_row() && DBUG_ASSERT(is_current_stmt_binlog_format_row());
((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open())); DBUG_ASSERT((WSREP_NNULL(this) && wsrep_emulate_bin_log) ||
mysql_bin_log.is_open());
/** /**
Save a reference to the original read bitmaps 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, int THD::binlog_delete_row(TABLE* table, bool is_trans,
uchar const *record) uchar const *record)
{ {
DBUG_ASSERT(is_current_stmt_binlog_format_row() && DBUG_ASSERT(is_current_stmt_binlog_format_row());
((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open())); DBUG_ASSERT((WSREP_NNULL(this) && wsrep_emulate_bin_log) ||
mysql_bin_log.is_open());
/** /**
Save a reference to the original read bitmaps Save a reference to the original read bitmaps
We will need this to restore the bitmaps at the end as 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"); 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); DBUG_RETURN(0);
/* Ensure that all events in a GTID group are in the same cache */ /* 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 mode: it might be the case that we left row-based mode before
flushing anything (e.g., if we have explicitly locked tables). 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); DBUG_RETURN(0);
/* Ensure that all events in a GTID group are in the same cache */ /* 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)); show_query_type(qtype), (int) query_len, query_arg));
DBUG_ASSERT(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 this is withing a BEGIN ... COMMIT group, don't log it */
if (variables.option_bits & OPTION_GTID_BEGIN) if (variables.option_bits & OPTION_GTID_BEGIN)

View File

@ -4550,7 +4550,7 @@ public:
{ {
query_id= new_query_id; query_id= new_query_id;
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (WSREP(this)) if (WSREP_NNULL(this))
{ {
set_wsrep_next_trx_id(query_id); set_wsrep_next_trx_id(query_id);
WSREP_DEBUG("assigned new next trx id: %" PRIu64, wsrep_next_trx_id()); WSREP_DEBUG("assigned new next trx id: %" PRIu64, wsrep_next_trx_id());

View File

@ -4599,7 +4599,7 @@ bool select_create::send_eof()
wsrep_start_transaction(thd, thd->wsrep_next_trx_id()); wsrep_start_transaction(thd, thd->wsrep_next_trx_id());
} }
DBUG_ASSERT(thd->wsrep_trx_id() != WSREP_UNDEFINED_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); thd->wsrep_trx_id(), thd->thread_id, thd->query_id);
/* /*

View File

@ -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 use autoinc values passed in binlog events, not the values forced by
the cluster. 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) !slave_thread && wsrep_auto_increment_control)
{ {
variables.auto_increment_offset= variables.auto_increment_offset=

View File

@ -49,7 +49,7 @@ void wsrep_notify_status(enum wsrep::server_state::state status,
" --primary %s", view->view_seqno().get() >= 0 ? "yes" : "no"); " --primary %s", view->view_seqno().get() >= 0 ? "yes" : "no");
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off,
" --index %ld", view->own_index()); " --index %zd", view->own_index());
const std::vector<wsrep::view::member>& members(view->members()); const std::vector<wsrep::view::member>& members(view->members());
if (members.size()) if (members.size())