MDEV-11849: Fix storage/innobase/* compile warnings

This commit is contained in:
Jan Lindström 2017-01-25 10:11:37 +02:00
parent 45f451c769
commit 71495a1748
28 changed files with 86 additions and 125 deletions

View file

@ -19,9 +19,13 @@ MACRO (MYSQL_CHECK_LZ4)
IF (WITH_INNODB_LZ4 STREQUAL "ON" OR WITH_INNODB_LZ4 STREQUAL "AUTO")
CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H)
CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_limitedOutput "" HAVE_LZ4_SHARED_LIB)
CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_default "" HAVE_LZ4_COMPRESS_DEFAULT)
IF (HAVE_LZ4_SHARED_LIB AND HAVE_LZ4_H)
ADD_DEFINITIONS(-DHAVE_LZ4=1)
IF (HAVE_LZ4_COMPRESS_DEFAULT)
ADD_DEFINITIONS(-DHAVE_LZ4_COMPRESS_DEFAULT=1)
ENDIF()
LINK_LIBRARIES(lz4)
ELSE()
IF (WITH_INNODB_LZ4 STREQUAL "ON")
@ -35,9 +39,13 @@ MACRO (MYSQL_CHECK_LZ4_STATIC)
IF (WITH_INNODB_LZ4 STREQUAL "ON" OR WITH_INNODB_LZ4 STREQUAL "AUTO")
CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H)
CHECK_LIBRARY_EXISTS(liblz4.a LZ4_compress_limitedOutput "" HAVE_LZ4_LIB)
CHECK_LIBRARY_EXISTS(liblz3.a LZ4_compress_default "" HAVE_LZ4_COMPRESS_DEFAULT)
IF(HAVE_LZ4_LIB AND HAVE_LZ4_H)
ADD_DEFINITIONS(-DHAVE_LZ4=1)
IF (HAVE_LZ4_COMPRESS_DEFAULT)
ADD_DEFINITIONS(-DHAVE_LZ4_COMPRESS_DEFAULT=1)
ENDIF()
LINK_LIBRARIES(liblz4.a)
ELSE()
IF (WITH_INNODB_LZ4 STREQUAL "ON")
@ -45,4 +53,4 @@ MACRO (MYSQL_CHECK_LZ4_STATIC)
ENDIF()
ENDIF()
ENDIF()
ENDMACRO()
ENDMACRO()

View file

@ -3638,7 +3638,7 @@ btr_cur_update_in_place(
#ifdef UNIV_DEBUG
{
rec_printer p(rec, offsets);
DBUG_PRINT("ib_cur", ("update-in-place %s (" IB_ID_FMT ") by "IB_ID_FMT ": %s",
DBUG_PRINT("ib_cur", ("update-in-place %s (" IB_ID_FMT ") by " IB_ID_FMT ": %s",
index->name(), index->id, trx_id,
p.str().c_str()));
}

View file

@ -121,8 +121,8 @@ bool
btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
const char * file, uint line)
{
uint start = time(0);
uint last = start;
time_t start = time(0);
time_t last = start;
while (mutex_enter_nowait(&(dict_sys->mutex))) {
/* if we lock to close a table, we wait forever
@ -136,10 +136,11 @@ btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
}
os_thread_sleep(250000);
uint now = time(0);
time_t now = time(0);
if (now >= last + 30) {
fprintf(stderr,
"WARNING: %s:%u waited %u seconds for"
"WARNING: %s:%u waited %lu seconds for"
" dict_sys lock, space: %lu"
" lock_to_close_table: %u\n",
file, line, now - start, space,

View file

@ -2007,7 +2007,7 @@ dict_foreign_def_get(
char* fk_def = (char *)mem_heap_alloc(foreign->heap, 4*1024);
const char* tbname;
char tablebuf[MAX_TABLE_NAME_LEN + 1] = "";
int i;
unsigned i;
char* bufend;
tbname = dict_remove_db_name(foreign->id);
@ -2025,7 +2025,7 @@ dict_foreign_def_get(
strlen(foreign->foreign_col_names[i]),
trx->mysql_thd);
strcat(fk_def, buf);
if (i < foreign->n_fields-1) {
if (i < static_cast<unsigned>(foreign->n_fields-1)) {
strcat(fk_def, (char *)",");
}
}
@ -2049,7 +2049,7 @@ dict_foreign_def_get(
trx->mysql_thd);
buf[bufend - buf] = '\0';
strcat(fk_def, buf);
if (i < foreign->n_fields-1) {
if (i < (uint)foreign->n_fields-1) {
strcat(fk_def, (char *)",");
}
}

View file

@ -1200,7 +1200,7 @@ struct rotate_thread_t {
uint estimated_max_iops; /*!< estimation of max iops */
uint allocated_iops; /*!< allocated iops */
uint cnt_waited; /*!< #times waited during this slot */
uint sum_waited_us; /*!< wait time during this slot */
uintmax_t sum_waited_us; /*!< wait time during this slot */
fil_crypt_stat_t crypt_stat; // statistics
@ -2457,8 +2457,8 @@ fil_space_crypt_close_tablespace(
return;
}
uint start = time(0);
uint last = start;
time_t start = time(0);
time_t last = start;
mutex_enter(&crypt_data->mutex);
mutex_exit(&fil_crypt_threads_mutex);
@ -2480,7 +2480,7 @@ fil_space_crypt_close_tablespace(
cnt = crypt_data->rotate_state.active_threads;
flushing = crypt_data->rotate_state.flushing;
uint now = time(0);
time_t now = time(0);
if (now >= last + 30) {
ib::warn() << "Waited "

View file

@ -703,7 +703,7 @@ retry:
extent_size);
}
node->size = size_bytes / psize;
node->size = static_cast<ulint>(size_bytes / psize);
space->size += node->size;
}
}
@ -6892,7 +6892,7 @@ fil_node_t*
fil_space_get_node(
fil_space_t* space, /*!< in: file spage */
ulint space_id, /*!< in: space id */
ulint* block_offset, /*!< in/out: offset in number of blocks */
os_offset_t* block_offset, /*!< in/out: offset in number of blocks */
ulint byte_offset, /*!< in: remainder of offset in bytes; in
aio this must be divisible by the OS block
size */
@ -6928,14 +6928,16 @@ fil_space_get_node(
/********************************************************************//**
Return block size of node in file space
@param[in] space_id space id
@param[in] block_offset page offset
@param[in] len page len
@return file block size */
UNIV_INTERN
ulint
fil_space_get_block_size(
/*=====================*/
ulint space_id,
ulint block_offset,
ulint len)
ulint space_id,
os_offset_t block_offset,
ulint len)
{
ulint block_size = 512;
ut_ad(!mutex_own(&fil_system->mutex));

View file

@ -162,8 +162,14 @@ fil_compress_page(
switch(comp_method) {
#ifdef HAVE_LZ4
case PAGE_LZ4_ALGORITHM:
#ifdef HAVE_LZ4_COMPRESS_DEFAULT
err = LZ4_compress_default((const char *)buf,
(char *)out_buf+header_len, len, write_size);
#else
err = LZ4_compress_limitedOutput((const char *)buf,
(char *)out_buf+header_len, len, write_size);
#endif /* HAVE_LZ4_COMPRESS_DEFAULT */
write_size = err;
if (err == 0) {
@ -414,7 +420,7 @@ fil_decompress_page(
{
int err = 0;
ulint actual_size = 0;
ulint compression_alg = 0;
ib_uint64_t compression_alg = 0;
byte *in_buf;
ulint ptype;
ulint header_len;
@ -463,7 +469,7 @@ fil_decompress_page(
/* Get compression algorithm */
if (ptype == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
compression_alg = mach_read_from_2(buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE);
compression_alg = static_cast<ib_uint64_t>(mach_read_from_2(buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE));
} else {
compression_alg = mach_read_from_8(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
}

View file

@ -3262,7 +3262,6 @@ fseg_free_extent(
ulint descr_n_used;
ulint i;
ut_ad(seg_inode != NULL);
ut_ad(mtr != NULL);
descr = xdes_get_descriptor(space, page, page_size, mtr);

View file

@ -5499,14 +5499,8 @@ innobase_kill_query(
trx_mutex_taken = true;
}
#ifdef UNIV_DEBUG
dberr_t err =
#endif
lock_trx_handle_wait(trx, true, true);
ut_ad(err == DB_SUCCESS || err == DB_LOCK_WAIT
|| err == DB_DEADLOCK);
if (lock_mutex_taken) {
lock_mutex_exit();
}
@ -11950,7 +11944,7 @@ err_col:
err = row_create_table_for_mysql(
table, m_trx, false,
(fil_encryption_t)options->encryption,
options->encryption_key_id);
(ulint)options->encryption_key_id);
}
@ -12904,7 +12898,7 @@ index_bad:
m_use_data_dir,
options->page_compressed,
options->page_compression_level == 0 ?
default_compression_level : options->page_compression_level,
default_compression_level : static_cast<ulint>(options->page_compression_level),
0);
/* Set the flags2 when create table or alter tables */

View file

@ -5166,9 +5166,6 @@ innobase_check_foreign_key_index(
ulint n_drop_fk) /*!< in: Number of foreign keys
to drop */
{
ut_ad(index != NULL);
ut_ad(indexed_table != NULL);
const dict_foreign_set* fks = &indexed_table->referenced_set;
/* Check for all FK references from other tables to the index. */
@ -7257,7 +7254,7 @@ innobase_enlarge_columns_try(
== IS_EQUAL_PACK_LENGTH
&& innobase_enlarge_column_try(
user_table, trx, table_name,
idx, cf->length, is_v)) {
idx, static_cast<ulint>(cf->length), is_v)) {
return(true);
}

View file

@ -467,7 +467,6 @@ dtuple_create_from_mem(
dtuple_t* tuple;
ulint n_t_fields = n_fields + n_v_fields;
ut_ad(buf != NULL);
ut_a(buf_size >= DTUPLE_EST_ALLOC(n_t_fields));
tuple = (dtuple_t*) buf;

View file

@ -1006,25 +1006,6 @@ dict_tf_set(
ulint page_compression_level,
ulint not_used);
/** Initialize a dict_table_t::flags pointer.
@param[in] compact, Table uses Compact or greater
@param[in] zip_ssize Zip Shift Size (log 2 minus 9)
@param[in] atomic_blobs Table uses Compressed or Dynamic
@param[in] data_dir Table uses DATA DIRECTORY
@param[in] page_compressed Table uses page compression
@param[in] page_compression_level Page compression level
@param[in] not_used For future */
UNIV_INLINE
ulint
dict_tf_init(
bool compact,
ulint zip_ssize,
bool atomic_blobs,
bool data_dir,
bool page_compressed,
ulint page_compression_level,
ulint not_used);
/** Convert a 32 bit integer table flags to the 32 bit FSP Flags.
Fsp Flags are written into the tablespace header at the offset
FSP_SPACE_FLAGS and are also stored in the fil_space_t::flags field.

View file

@ -1242,7 +1242,6 @@ ulint
dict_index_get_n_unique_in_tree_nonleaf(
const dict_index_t* index)
{
ut_ad(index != NULL);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
ut_ad(index->cached);

View file

@ -1572,15 +1572,16 @@ void test_make_filepath();
/*******************************************************************//**
Returns the block size of the file space
@param[in] space_id space id
@param[in] offset page offset
@param[in] len page len
@return block size */
UNIV_INTERN
ulint
fil_space_get_block_size(
/*=====================*/
ulint id, /*!< in: space id */
ulint offset, /*!< in: page offset */
ulint len); /*!< in: page len */
ulint id,
os_offset_t offset,
ulint len);
/*******************************************************************//**
Increments the count of pending operation, if space is not being deleted.
@return TRUE if being deleted, and operation should be skipped */

View file

@ -892,8 +892,7 @@ lock_trx_handle_wait(
/*=================*/
trx_t* trx, /*!< in/out: trx lock state */
bool lock_mutex_taken,
bool trx_mutex_taken)
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
bool trx_mutex_taken);
/*********************************************************************//**
Get the number of locks on a table.
@return number of locks */

View file

@ -431,8 +431,8 @@ row_merge_sort(
row_merge_block_t* block,
int* tmpfd,
const bool update_progress,
const float pct_progress,
const float pct_cost,
const double pct_progress,
const double pct_cost,
fil_space_crypt_t* crypt_data,
row_merge_block_t* crypt_block,
ulint space,

View file

@ -201,13 +201,13 @@ row_parse_int(
case DATA_FLOAT:
ut_a(len == sizeof(float));
value = mach_float_read(data);
value = static_cast<ib_uint64_t>(mach_float_read(data));
break;
case DATA_DOUBLE:
ut_a(len == sizeof(double));
value = mach_double_read(data);
value = static_cast<ib_uint64_t>(mach_double_read(data));
break;
default:

View file

@ -106,7 +106,7 @@ ut_microseconds_to_timer(
/*=====================*/
ulonglong when) /*!< in: time where to calculate */
{
double ret = when;
double ret = (double)when;
ret *= (double)(ut_timer.frequency);
ret /= 1000000.0;
return (ulonglong)ret;

View file

@ -7770,6 +7770,9 @@ lock_trx_handle_wait(
trx_mutex_exit(trx);
}
ut_ad(err == DB_SUCCESS || err == DB_LOCK_WAIT
|| err == DB_DEADLOCK);
return(err);
}

View file

@ -142,14 +142,13 @@ log_crypt_print_checkpoint_keys(
ib_uint64_t checkpoint_no = log_block_get_checkpoint_no(log_block);
if (crypt_info.size()) {
fprintf(stderr, "InnoDB: redo log checkpoint: %lu [ chk key ]: ", (ulong) checkpoint_no);
ib::info() << "Redo log checkpoint encryption: " << checkpoint_no << " [ chk key ]: ";
for (size_t i = 0; i < crypt_info.size(); i++) {
struct crypt_info_t* it = &crypt_info[i];
fprintf(stderr, "[ %lu %u ] ",
(ulong) it->checkpoint_no,
it->key_version);
ib::info() << "[" << it->checkpoint_no
<< "," << it->key_version
<< "]";
}
fprintf(stderr, "\n");
}
}
@ -498,7 +497,7 @@ log_crypt_write_checkpoint_buf(
buf += 2;
for (size_t i = 0; i < crypt_info.size(); i++) {
struct crypt_info_t* it = &crypt_info[i];
mach_write_to_4(buf + 0, it->checkpoint_no);
mach_write_to_4(buf + 0, static_cast<ulint>(it->checkpoint_no));
mach_write_to_4(buf + 4, it->key_version);
memcpy(buf + 8, it->crypt_msg, MY_AES_BLOCK_SIZE);
memcpy(buf + 24, it->crypt_nonce, MY_AES_BLOCK_SIZE);

View file

@ -2596,7 +2596,7 @@ DECLARE_THREAD(log_scrub_thread)(void*)
/* log scrubbing interval in µs. */
ulonglong interval = 1000*1000*512/innodb_scrub_log_speed;
os_event_wait_time(log_scrub_event, interval);
os_event_wait_time(log_scrub_event, static_cast<ulint>(interval));
log_scrub();

View file

@ -2755,43 +2755,15 @@ os_file_readdir_next_file(
int ret;
struct stat statinfo;
#ifdef HAVE_READDIR_R
char dirent_buf[sizeof(struct dirent)
+ _POSIX_PATH_MAX + 100];
/* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
the max file name len; but in most standards, the
length is NAME_MAX; we add 100 to be even safer */
#endif /* HAVE_READDIR_R */
next_file:
#ifdef HAVE_READDIR_R
ret = readdir_r(dir, (struct dirent*) dirent_buf, &ent);
if (ret != 0) {
ib::error()
<< "Cannot read directory " << dirname
<< " error: " << ret;
return(-1);
}
if (ent == NULL) {
/* End of directory */
return(1);
}
ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);
#else
ent = readdir(dir);
if (ent == NULL) {
return(1);
}
#endif /* HAVE_READDIR_R */
ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH);
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {

View file

@ -526,7 +526,7 @@ err_exit:
my_atomic_addlint(&onlineddl_rowlog_rows, 1);
/* 10000 means 100.00%, 4525 means 45.25% */
onlineddl_rowlog_pct_used = (log->tail.total * 10000) / srv_online_max_size;
onlineddl_rowlog_pct_used = static_cast<ulint>((log->tail.total * 10000) / srv_online_max_size);
}
#ifdef UNIV_DEBUG

View file

@ -378,9 +378,9 @@ row_merge_insert_index_tuples(
const row_merge_buf_t* row_buf,
BtrBulk* btr_bulk,
const ib_uint64_t table_total_rows, /*!< in: total rows of old table */
const float pct_progress, /*!< in: total progress
const double pct_progress, /*!< in: total progress
percent until now */
const float pct_cost, /*!< in: current progress percent
const double pct_cost, /*!< in: current progress percent
*/
fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
@ -1820,7 +1820,7 @@ row_merge_read_clustered_index(
bool skip_pk_sort,
int* tmpfd,
ut_stage_alter_t* stage,
float pct_cost,
double pct_cost,
fil_space_crypt_t* crypt_data,
row_merge_block_t* crypt_block,
struct TABLE* eval_table)
@ -1855,7 +1855,7 @@ row_merge_read_clustered_index(
mtuple_t prev_mtuple;
mem_heap_t* conv_heap = NULL;
FlushObserver* observer = trx->flush_observer;
float curr_progress = 0.0;
double curr_progress = 0.0;
ib_uint64_t read_rows = 0;
ib_uint64_t table_total_rows = 0;
@ -3268,10 +3268,10 @@ row_merge_sort(
const bool update_progress,
/*!< in: update progress
status variable or not */
const float pct_progress,
const double pct_progress,
/*!< in: total progress percent
until now */
const float pct_cost, /*!< in: current progress percent */
const double pct_cost, /*!< in: current progress percent */
fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space, /*!< in: space id */
@ -3283,7 +3283,7 @@ row_merge_sort(
dberr_t error = DB_SUCCESS;
ulint merge_count = 0;
ulint total_merge_sort_count;
float curr_progress = 0;
double curr_progress = 0;
DBUG_ENTER("row_merge_sort");
@ -3296,7 +3296,7 @@ row_merge_sort(
/* Find the number N which 2^N is greater or equal than num_runs */
/* N is merge sort running count */
total_merge_sort_count = (ulint) ceil(my_log2f(num_runs));
total_merge_sort_count = (ulint) ceil(my_log2f((float)num_runs));
if(total_merge_sort_count <= 0) {
total_merge_sort_count=1;
}
@ -3482,9 +3482,9 @@ row_merge_insert_index_tuples(
const row_merge_buf_t* row_buf,
BtrBulk* btr_bulk,
const ib_uint64_t table_total_rows, /*!< in: total rows of old table */
const float pct_progress, /*!< in: total progress
const double pct_progress, /*!< in: total progress
percent until now */
const float pct_cost, /*!< in: current progress percent
const double pct_cost, /*!< in: current progress percent
*/
fil_space_crypt_t* crypt_data,/*!< in: table crypt data */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
@ -3501,7 +3501,7 @@ row_merge_insert_index_tuples(
ulint n_rows = 0;
dtuple_t* dtuple;
ib_uint64_t inserted_rows = 0;
float curr_progress = 0;
double curr_progress = 0;
dict_index_t* old_index = NULL;
const mrec_t* mrec = NULL;
ulint n_ext = 0;
@ -4661,11 +4661,11 @@ row_merge_build_indexes(
bool fts_psort_initiated = false;
fil_space_crypt_t * crypt_data = NULL;
float total_static_cost = 0;
float total_dynamic_cost = 0;
double total_static_cost = 0;
double total_dynamic_cost = 0;
uint total_index_blocks = 0;
float pct_cost=0;
float pct_progress=0;
double pct_cost=0;
double pct_progress=0;
DBUG_ENTER("row_merge_build_indexes");

View file

@ -3435,8 +3435,8 @@ void
fil_wait_crypt_bg_threads(
dict_table_t* table)
{
uint start = time(0);
uint last = start;
time_t start = time(0);
time_t last = start;
if (table->space != 0) {
fil_space_crypt_mark_space_closing(table->space, table->crypt_data);
}
@ -3445,7 +3445,8 @@ fil_wait_crypt_bg_threads(
dict_mutex_exit_for_mysql();
os_thread_sleep(20000);
dict_mutex_enter_for_mysql();
uint now = time(0);
time_t now = time(0);
if (now >= last + 30) {
ib::warn()
<< "Waited " << now - start

View file

@ -5273,7 +5273,7 @@ locks_ok:
This optimization can avoid many IOs for certain schemas.
*/
ibool row_contains_all_values = TRUE;
int i;
uint i;
for (i = 0; i < prebuilt->n_template; i++) {
/* Condition (1) from above: is the field in the
index (prefix or not)? */

View file

@ -1340,7 +1340,7 @@ sync_arr_fill_sys_semphore_waits_table(
*/
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_FILE], innobase_basename(cell->file)));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LINE], cell->line));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME], (longlong)difftime(time(NULL), cell->reservation_time)));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME], (ulint)difftime(time(NULL), cell->reservation_time)));
if (type == SYNC_MUTEX) {
mutex = static_cast<WaitMutex*>(cell->latch.mutex);

View file

@ -498,7 +498,7 @@ rw_lock_x_lock_wait_func(
rw_lock_stats.rw_x_spin_round_count.add(n_spins);
if (count_os_wait > 0) {
lock->count_os_wait += count_os_wait;
lock->count_os_wait += static_cast<uint32_t>(count_os_wait);
rw_lock_stats.rw_x_os_wait_count.add(count_os_wait);
}