Skip to content

Commit

Permalink
MDEV-11849: Fix storage/innobase/* compile warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Lindström committed Jan 26, 2017
1 parent 45f451c commit 71495a1
Show file tree
Hide file tree
Showing 28 changed files with 86 additions and 125 deletions.
10 changes: 9 additions & 1 deletion cmake/lz4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -35,14 +39,18 @@ 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")
MESSAGE(FATAL_ERROR "Required lz4 library is not found")
ENDIF()
ENDIF()
ENDIF()
ENDMACRO()
ENDMACRO()
2 changes: 1 addition & 1 deletion storage/innobase/btr/btr0cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
Expand Down
9 changes: 5 additions & 4 deletions storage/innobase/btr/btr0scrub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions storage/innobase/dict/dict0crea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 *)",");
}
}
Expand All @@ -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 *)",");
}
}
Expand Down
8 changes: 4 additions & 4 deletions storage/innobase/fil/fil0crypt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand All @@ -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 "
Expand Down
14 changes: 8 additions & 6 deletions storage/innobase/fil/fil0fil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ fil_node_open_file(
extent_size);
}

node->size = size_bytes / psize;
node->size = static_cast<ulint>(size_bytes / psize);
space->size += node->size;
}
}
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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));
Expand Down
10 changes: 8 additions & 2 deletions storage/innobase/fil/fil0pagecompress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 0 additions & 1 deletion storage/innobase/fsp/fsp0fsp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 2 additions & 8 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -11950,7 +11944,7 @@ create_table_info_t::create_table_def()
err = row_create_table_for_mysql(
table, m_trx, false,
(fil_encryption_t)options->encryption,
options->encryption_key_id);
(ulint)options->encryption_key_id);

}

Expand Down Expand Up @@ -12904,7 +12898,7 @@ create_table_info_t::innobase_table_flags()
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 */
Expand Down
5 changes: 1 addition & 4 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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);
}

Expand Down
1 change: 0 additions & 1 deletion storage/innobase/include/data0data.ic
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 0 additions & 19 deletions storage/innobase/include/dict0dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion storage/innobase/include/dict0dict.ic
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
11 changes: 6 additions & 5 deletions storage/innobase/include/fil0fil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/include/lock0lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/include/row0merge.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/include/row0row.ic
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/ut0timer.ic
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions storage/innobase/lock/lock0lock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Loading

0 comments on commit 71495a1

Please sign in to comment.