Commit 46b78526 authored by Marko Mäkelä's avatar Marko Mäkelä

Fix -Wunused for CMAKE_BUILD_TYPE=RelWithDebInfo

For release builds, do not declare unused variables.

unpack_row(): Omit a debug-only variable from WSREP diagnostic message.

create_wsrep_THD(): Fix -Wmaybe-uninitialized for the PSI_thread_key.
parent bc70862e
...@@ -1186,12 +1186,9 @@ PSI_statement_info stmt_info_new_packet; ...@@ -1186,12 +1186,9 @@ PSI_statement_info stmt_info_new_packet;
#endif #endif
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
void net_before_header_psi(struct st_net *net, void *user_data, size_t /* unused: count */) void net_before_header_psi(struct st_net *net, void *thd, size_t /* unused: count */)
{ {
THD *thd; DBUG_ASSERT(thd);
thd= static_cast<THD*> (user_data);
DBUG_ASSERT(thd != NULL);
/* /*
We only come where when the server is IDLE, waiting for the next command. We only come where when the server is IDLE, waiting for the next command.
Technically, it is a wait on a socket, which may take a long time, Technically, it is a wait on a socket, which may take a long time,
...@@ -1200,7 +1197,8 @@ void net_before_header_psi(struct st_net *net, void *user_data, size_t /* unused ...@@ -1200,7 +1197,8 @@ void net_before_header_psi(struct st_net *net, void *user_data, size_t /* unused
Instead, start explicitly an IDLE event. Instead, start explicitly an IDLE event.
*/ */
MYSQL_SOCKET_SET_STATE(net->vio->mysql_socket, PSI_SOCKET_STATE_IDLE); MYSQL_SOCKET_SET_STATE(net->vio->mysql_socket, PSI_SOCKET_STATE_IDLE);
MYSQL_START_IDLE_WAIT(thd->m_idle_psi, &thd->m_idle_state); MYSQL_START_IDLE_WAIT(static_cast<THD*>(thd)->m_idle_psi,
&static_cast<THD*>(thd)->m_idle_state);
} }
void net_after_header_psi(struct st_net *net, void *user_data, void net_after_header_psi(struct st_net *net, void *user_data,
......
/* Copyright (c) 2007, 2013, Oracle and/or its affiliates. /* Copyright (c) 2007, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2014, SkySQL Ab. Copyright (c) 2008, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -318,7 +318,7 @@ unpack_row(rpl_group_info *rgi, ...@@ -318,7 +318,7 @@ unpack_row(rpl_group_info *rgi,
normal unpack operation. normal unpack operation.
*/ */
uint16 const metadata= tabledef->field_metadata(i); uint16 const metadata= tabledef->field_metadata(i);
uchar const *const old_pack_ptr= pack_ptr; IF_DBUG(uchar const *const old_pack_ptr= pack_ptr;,)
pack_ptr= f->unpack(f->ptr, pack_ptr, row_end, metadata); pack_ptr= f->unpack(f->ptr, pack_ptr, row_end, metadata);
DBUG_PRINT("debug", ("field: %s; metadata: 0x%x;" DBUG_PRINT("debug", ("field: %s; metadata: 0x%x;"
...@@ -336,10 +336,9 @@ unpack_row(rpl_group_info *rgi, ...@@ -336,10 +336,9 @@ unpack_row(rpl_group_info *rgi,
Galera Node throws "Could not read field" error and drops out of cluster Galera Node throws "Could not read field" error and drops out of cluster
*/ */
WSREP_WARN("ROW event unpack field: %s metadata: 0x%x;" WSREP_WARN("ROW event unpack field: %s metadata: 0x%x;"
" pack_ptr: %p; conv_table %p conv_field %p table %s" " conv_table %p conv_field %p table %s"
" row_end: %p", " row_end: %p",
f->field_name, metadata, f->field_name, metadata, conv_table, conv_field,
old_pack_ptr, conv_table, conv_field,
(table_found) ? "found" : "not found", row_end (table_found) ? "found" : "not found", row_end
); );
} }
......
...@@ -8405,9 +8405,9 @@ bool st_select_lex::add_cross_joined_table(TABLE_LIST *left_op, ...@@ -8405,9 +8405,9 @@ bool st_select_lex::add_cross_joined_table(TABLE_LIST *left_op,
TABLE_LIST *tbl; TABLE_LIST *tbl;
List<TABLE_LIST> *right_op_jl= right_op->join_list; List<TABLE_LIST> *right_op_jl= right_op->join_list;
TABLE_LIST *r_tbl= right_op_jl->pop(); IF_DBUG(const TABLE_LIST *r_tbl=,) right_op_jl->pop();
DBUG_ASSERT(right_op == r_tbl); DBUG_ASSERT(right_op == r_tbl);
TABLE_LIST *l_tbl= right_op_jl->pop(); IF_DBUG(const TABLE_LIST *l_tbl=,) right_op_jl->pop();
DBUG_ASSERT(left_op == l_tbl); DBUG_ASSERT(left_op == l_tbl);
TABLE_LIST *cj_nest; TABLE_LIST *cj_nest;
......
...@@ -60,7 +60,7 @@ bool Sql_cmd_alter_table_exchange_partition::execute(THD *thd) ...@@ -60,7 +60,7 @@ bool Sql_cmd_alter_table_exchange_partition::execute(THD *thd)
referenced from this structure will be modified. referenced from this structure will be modified.
@todo move these into constructor... @todo move these into constructor...
*/ */
HA_CREATE_INFO create_info(lex->create_info); IF_DBUG(HA_CREATE_INFO create_info(lex->create_info);,)
Alter_info alter_info(lex->alter_info, thd->mem_root); Alter_info alter_info(lex->alter_info, thd->mem_root);
ulong priv_needed= ALTER_ACL | DROP_ACL | INSERT_ACL | CREATE_ACL; ulong priv_needed= ALTER_ACL | DROP_ACL | INSERT_ACL | CREATE_ACL;
......
...@@ -10606,10 +10606,10 @@ bool Sql_cmd_create_table::execute(THD *thd) ...@@ -10606,10 +10606,10 @@ bool Sql_cmd_create_table::execute(THD *thd)
{ {
DBUG_ENTER("Sql_cmd_create_table::execute"); DBUG_ENTER("Sql_cmd_create_table::execute");
LEX *lex= thd->lex; LEX *lex= thd->lex;
TABLE_LIST *all_tables= lex->query_tables;
SELECT_LEX *select_lex= &lex->select_lex; SELECT_LEX *select_lex= &lex->select_lex;
TABLE_LIST *first_table= select_lex->table_list.first; TABLE_LIST *first_table= select_lex->table_list.first;
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == lex->query_tables);
DBUG_ASSERT(first_table != 0);
bool link_to_local; bool link_to_local;
TABLE_LIST *create_table= first_table; TABLE_LIST *create_table= first_table;
TABLE_LIST *select_tables= lex->create_last_non_select_table->next_global; TABLE_LIST *select_tables= lex->create_last_non_select_table->next_global;
......
/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. /* Copyright (c) 2002, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab. Copyright (c) 2010, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -629,7 +629,7 @@ public: ...@@ -629,7 +629,7 @@ public:
/* parse and feel list with default values */ /* parse and feel list with default values */
if (thd) if (thd)
{ {
bool res= IF_DBUG(bool res=,)
sysvartrack_validate_value(thd, sysvartrack_validate_value(thd,
var->save_result.string_value.str, var->save_result.string_value.str,
var->save_result.string_value.length); var->save_result.string_value.length);
......
...@@ -420,25 +420,12 @@ static bool create_wsrep_THD(wsrep_thread_args* args) ...@@ -420,25 +420,12 @@ static bool create_wsrep_THD(wsrep_thread_args* args)
{ {
mysql_mutex_lock(&LOCK_thread_count); mysql_mutex_lock(&LOCK_thread_count);
ulong old_wsrep_running_threads= wsrep_running_threads; ulong old_wsrep_running_threads= wsrep_running_threads;
#ifdef HAVE_PSI_THREAD_INTERFACE DBUG_ASSERT(args->thread_type == WSREP_APPLIER_THREAD ||
PSI_thread_key key; args->thread_type == WSREP_ROLLBACKER_THREAD);
bool res= mysql_thread_create(args->thread_type == WSREP_APPLIER_THREAD
switch (args->thread_type) ? key_wsrep_applier : key_wsrep_rollbacker,
{ &args->thread_id, &connection_attrib,
case WSREP_APPLIER_THREAD: start_wsrep_THD, (void*)args);
key= key_wsrep_applier;
break;
case WSREP_ROLLBACKER_THREAD:
key= key_wsrep_rollbacker;
break;
default:
assert(0);
break;
}
#endif
bool res= mysql_thread_create(key, &args->thread_id, &connection_attrib, start_wsrep_THD,
(void*)args);
/* /*
if starting a thread on server startup, wait until the this thread's THD if starting a thread on server startup, wait until the this thread's THD
is fully initialized (otherwise a THD initialization code might is fully initialized (otherwise a THD initialization code might
......
...@@ -2308,8 +2308,8 @@ static void fil_crypt_rotation_list_fill() ...@@ -2308,8 +2308,8 @@ static void fil_crypt_rotation_list_fill()
/* Protect the tablespace while we may /* Protect the tablespace while we may
release fil_system->mutex. */ release fil_system->mutex. */
space->n_pending_ops++; space->n_pending_ops++;
fil_space_t* s= fil_system->read_page0( ut_d(const fil_space_t* s=)
space->id); fil_system->read_page0(space->id);
ut_ad(!s || s == space); ut_ad(!s || s == space);
space->n_pending_ops--; space->n_pending_ops--;
if (!space->size) { if (!space->size) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment