Fix some GCC 7 warnings for InnoDB

buf_page_io_complete(): Do not test bpage for NULL, because
it is declared (and always passed) as nonnull.

buf_flush_batch(): Remove the constant local variable count=0.

fil_ibd_load(): Use magic comment to suppress -Wimplicit-fallthrough.

ut_stage_alter_t::inc(ulint): Disable references to an unused parameter.

lock_queue_validate(), sync_array_find_thread(), rbt_check_ordering():
Define only in debug builds.
This commit is contained in:
Marko Mäkelä 2017-08-10 14:00:51 +03:00
parent cb2a57c203
commit bfffe571ac
7 changed files with 12 additions and 11 deletions

View File

@ -6038,7 +6038,7 @@ database_corrupted:
&& fil_page_get_type(frame) == FIL_PAGE_INDEX
&& page_is_leaf(frame)) {
if (bpage && bpage->encrypted) {
if (bpage->encrypted) {
ib::warn()
<< "Table in tablespace "
<< bpage->id.space()

View File

@ -1884,8 +1884,6 @@ buf_flush_batch(
buf_pool_mutex_enter(buf_pool);
ulint count = 0;
/* Note: The buffer pool mutex is released and reacquired within
the flush functions. */
switch (flush_type) {
@ -1902,8 +1900,7 @@ buf_flush_batch(
buf_pool_mutex_exit(buf_pool);
DBUG_PRINT("ib_buf", ("flush %u completed, %u pages",
unsigned(flush_type), unsigned(count)));
DBUG_LOG("ib_buf", "flush " << flush_type << " completed");
}
/******************************************************************//**

View File

@ -4644,7 +4644,7 @@ fil_ibd_load(
break;
}
/* Fall through to error handling */
/* fall through */
case DB_TABLESPACE_EXISTS:
return(FIL_LOAD_INVALID);

View File

@ -267,12 +267,10 @@ ut_stage_alter_t::n_pk_recs_inc()
}
/** Flag either one record or one page processed, depending on the
current phase.
@param[in] inc_val flag this many units processed at once */
current phase. */
inline
void
ut_stage_alter_t::inc(
ulint inc_val /* = 1 */)
ut_stage_alter_t::inc(ulint)
{
if (m_progress == NULL) {
return;
@ -286,12 +284,14 @@ ut_stage_alter_t::inc(
ut_error;
case READ_PK:
m_n_pk_pages++;
#if 0 /* TODO: MySQL 5.7 PSI */
ut_ad(inc_val == 1);
/* Overall the read pk phase will read all the pages from the
PK and will do work, proportional to the number of added
indexes, thus when this is called once per read page we
increment with 1 + m_n_sort_indexes */
inc_val = 1 + m_n_sort_indexes;
#endif
break;
case SORT:
multi_factor = m_sort_multi_factor;

View File

@ -1853,6 +1853,7 @@ lock_rec_insert_by_trx_age(
return DB_SUCCESS;
}
#ifdef UNIV_DEBUG
static
bool
lock_queue_validate(
@ -1888,6 +1889,7 @@ lock_queue_validate(
}
return true;
}
#endif /* UNIV_DEBUG */
static
void

View File

@ -621,6 +621,7 @@ sync_array_cell_print(
}
}
#ifdef UNIV_DEBUG
/******************************************************************//**
Looks for a cell with the given thread id.
@return pointer to cell or NULL if not found */
@ -648,7 +649,6 @@ sync_array_find_thread(
return(NULL); /* Not found */
}
#ifdef UNIV_DEBUG
/******************************************************************//**
Recursion step for deadlock detection.
@return TRUE if deadlock detected */

View File

@ -54,6 +54,7 @@ red-black properties:
#define ROOT(t) (t->root->left)
#define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1)
#if defined UNIV_DEBUG || defined IB_RBT_TESTING
/**********************************************************************//**
Verify that the keys are in order.
@return TRUE of OK. FALSE if not ordered */
@ -91,6 +92,7 @@ rbt_check_ordering(
return(TRUE);
}
#endif /* UNIV_DEBUG || IB_RBT_TESTING */
/**********************************************************************//**
Check that every path from the root to the leaves has the same count.