Skip to content

Commit

Permalink
Fix InnoDB/XtraDB compilation warnings on 32-bit builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Mar 9, 2017
1 parent ad0c218 commit 498f4a8
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 69 deletions.
3 changes: 2 additions & 1 deletion extra/innochecksum.cc
Expand Up @@ -394,7 +394,8 @@ parse_page(
size_range_id = SIZE_RANGES_FOR_PAGE + 1;
}
if (per_page_details) {
printf("index %lu page %lu leaf %u n_recs %lu data_bytes %lu"
printf("index " IB_ID_FMT " page " ULINTPF
" leaf %d n_recs " ULINTPF " data_bytes " ULINTPF
"\n", id, page_no, is_leaf, n_recs, data_bytes);
}
/* update per-index statistics */
Expand Down
3 changes: 2 additions & 1 deletion storage/innobase/buf/buf0buf.cc
Expand Up @@ -4887,7 +4887,8 @@ buf_all_freed_instance(
block->page.space,
block->page.offset);
ib_logf(IB_LOG_LEVEL_ERROR,
"Page oldest_modification %lu fix_count %d io_fix %d.",
"Page oldest_modification " LSN_PF
" fix_count %d io_fix %d.",
block->page.oldest_modification,
block->page.buf_fix_count,
buf_page_get_io_fix(&block->page));
Expand Down
11 changes: 7 additions & 4 deletions storage/innobase/fil/fil0crypt.cc
Expand Up @@ -473,7 +473,7 @@ fil_parse_write_crypt_data(
4 + // size of key_id
1; // fil_encryption_t

if (end_ptr - ptr < entry_size){
if (ptr + entry_size < end_ptr) {
return NULL;
}

Expand All @@ -499,7 +499,7 @@ fil_parse_write_crypt_data(
fil_encryption_t encryption = (fil_encryption_t)mach_read_from_1(ptr);
ptr +=1;

if (end_ptr - ptr < len) {
if (ptr + len < end_ptr) {
return NULL;
}

Expand Down Expand Up @@ -1480,7 +1480,8 @@ fil_crypt_space_needs_rotation(

bool need_scrubbing =
crypt_data->rotate_state.scrubbing.is_active
&& diff >= srv_background_scrub_data_interval;
&& diff >= 0
&& ulint(diff) >= srv_background_scrub_data_interval;

if (need_key_rotation == false && need_scrubbing == false) {
break;
Expand Down Expand Up @@ -2378,7 +2379,9 @@ DECLARE_THREAD(fil_crypt_thread)(

time_t waited = time(0) - wait_start;

if (waited >= srv_background_scrub_data_check_interval) {
if (waited >= 0
&& ulint(waited)
>= srv_background_scrub_data_check_interval) {
break;
}
}
Expand Down
13 changes: 9 additions & 4 deletions storage/innobase/lock/lock0lock.cc
Expand Up @@ -918,8 +918,10 @@ lock_reset_lock_and_trx_wait(
}

ib_logf(IB_LOG_LEVEL_INFO,
"Trx id %lu is waiting a lock in statement %s"
" for this trx id %lu and statement %s wait_lock %p",
"Trx id " TRX_ID_FMT
" is waiting a lock in statement %s"
" for this trx id " TRX_ID_FMT
" and statement %s wait_lock %p",
lock->trx->id,
stmt ? stmt : "NULL",
trx_id,
Expand Down Expand Up @@ -2622,7 +2624,8 @@ lock_rec_add_to_queue(
if (wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
if (wsrep_debug) {
fprintf(stderr,
"BF skipping wait: %lu\n",
"BF skipping wait: "
TRX_ID_FMT "\n",
trx->id);
lock_rec_print(stderr, lock);
}
Expand Down Expand Up @@ -5270,7 +5273,9 @@ lock_table_other_has_incompatible(
#ifdef WITH_WSREP
if(wsrep_thd_is_wsrep(trx->mysql_thd)) {
if (wsrep_debug) {
fprintf(stderr, "WSREP: trx %ld table lock abort\n",
fprintf(stderr, "WSREP: trx "
TRX_ID_FMT
" table lock abort\n",
trx->id);
}
trx_mutex_enter(lock->trx);
Expand Down
6 changes: 4 additions & 2 deletions storage/innobase/log/log0crypt.cc
Expand Up @@ -144,10 +144,12 @@ 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 ]: ", checkpoint_no);
fprintf(stderr,
"InnoDB: redo log checkpoint: %llu [ chk key ]: ",
checkpoint_no);
for (size_t i = 0; i < crypt_info.size(); i++) {
struct crypt_info_t* it = &crypt_info[i];
fprintf(stderr, "[ %lu %u ] ",
fprintf(stderr, "[ %llu %u ] ",
it->checkpoint_no,
it->key_version);
}
Expand Down
36 changes: 20 additions & 16 deletions storage/innobase/os/os0file.cc
Expand Up @@ -346,16 +346,17 @@ static os_ib_mutex_t os_file_count_mutex;
#endif /* !UNIV_HOTBACKUP && (!HAVE_ATOMIC_BUILTINS || UNIV_WORD_SIZE < 8) */

/** Number of pending os_file_pread() operations */
UNIV_INTERN ulint os_file_n_pending_preads = 0;
UNIV_INTERN ulint os_file_n_pending_preads;
/** Number of pending os_file_pwrite() operations */
UNIV_INTERN ulint os_file_n_pending_pwrites = 0;
UNIV_INTERN ulint os_file_n_pending_pwrites;
/** Number of pending write operations */
UNIV_INTERN ulint os_n_pending_writes = 0;
UNIV_INTERN ulint os_n_pending_writes;
/** Number of pending read operations */
UNIV_INTERN ulint os_n_pending_reads = 0;
UNIV_INTERN ulint os_n_pending_reads;

#if defined(WIN_ASYNC_IO) || defined(LINUX_NATIVE_AIO)
/** After first fallocate failure we will disable os_file_trim */
static ibool os_fallocate_failed;
static bool os_fallocate_failed;

/**********************************************************************//**
Directly manipulate the allocated disk space by deallocating for the file referred to
Expand All @@ -369,6 +370,7 @@ ibool
os_file_trim(
/*=========*/
os_aio_slot_t* slot); /*!< in: slot structure */
#endif /* WIN_ASYNC_IO || LINUX_NATIVE_AIO */

/****************************************************************//**
Does error handling when a file operation fails.
Expand Down Expand Up @@ -5262,7 +5264,7 @@ os_aio_windows_handle(
if (slot->type == OS_FILE_WRITE &&
!slot->is_log &&
srv_use_trim &&
os_fallocate_failed == FALSE) {
!os_fallocate_failed) {
// Deallocate unused blocks from file system
os_file_trim(slot);
}
Expand Down Expand Up @@ -5359,7 +5361,7 @@ os_aio_linux_collect(
if (slot->type == OS_FILE_WRITE &&
!slot->is_log &&
srv_use_trim &&
os_fallocate_failed == FALSE) {
!os_fallocate_failed) {
// Deallocate unused blocks from file system
os_file_trim(slot);
}
Expand Down Expand Up @@ -6220,14 +6222,15 @@ typedef struct _FILE_LEVEL_TRIM {
#endif
#endif

#if defined(WIN_ASYNC_IO) || defined(LINUX_NATIVE_AIO)
/**********************************************************************//**
Directly manipulate the allocated disk space by deallocating for the file referred to
by fd for the byte range starting at offset and continuing for len bytes.
Within the specified range, partial file system blocks are zeroed, and whole
file system blocks are removed from the file. After a successful call,
subsequent reads from this range will return zeroes.
@return true if success, false if error */
UNIV_INTERN
static
ibool
os_file_trim(
/*=========*/
Expand Down Expand Up @@ -6273,13 +6276,13 @@ os_file_trim(

if (ret) {
/* After first failure do not try to trim again */
os_fallocate_failed = TRUE;
os_fallocate_failed = true;
srv_use_trim = FALSE;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: fallocate call failed with error code %d.\n"
" InnoDB: start: %lu len: %lu payload: %lu\n"
" InnoDB: Disabling fallocate for now.\n", errno, off, trim_len, len);
ib_logf(IB_LOG_LEVEL_WARN,
"fallocate() failed with error %d."
" start: %llu len: " ULINTPF " payload: " ULINTPF "."
" Disabling fallocate for now.",
errno, off, ulint(trim_len), ulint(len));

os_file_handle_error_no_exit(slot->name,
" fallocate(FALLOC_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE) ",
Expand All @@ -6300,7 +6303,7 @@ os_file_trim(
fprintf(stderr,
" InnoDB: Warning: fallocate not supported on this installation."
" InnoDB: Disabling fallocate for now.");
os_fallocate_failed = TRUE;
os_fallocate_failed = true;
srv_use_trim = FALSE;
if (slot->write_size) {
*slot->write_size = 0;
Expand All @@ -6320,7 +6323,7 @@ os_file_trim(

if (!ret) {
/* After first failure do not try to trim again */
os_fallocate_failed = TRUE;
os_fallocate_failed = true;
srv_use_trim=FALSE;
ut_print_timestamp(stderr);
fprintf(stderr,
Expand Down Expand Up @@ -6374,6 +6377,7 @@ os_file_trim(
return (TRUE);

}
#endif /* WIN_ASYNC_IO || LINUX_NATIVE_AIO */
#endif /* !UNIV_HOTBACKUP */

/***********************************************************************//**
Expand Down
6 changes: 3 additions & 3 deletions storage/innobase/row/row0import.cc
Expand Up @@ -1870,10 +1870,10 @@ PageConverter::update_index_page(

if (index == 0) {
ib_logf(IB_LOG_LEVEL_ERROR,
"Page for tablespace %lu is "
" index page with id %lu but that"
"Page for tablespace " ULINTPF " is "
" index page with id " IB_ID_FMT " but that"
" index is not found from configuration file."
" Current index name %s and id %lu.",
" Current index name %s and id " IB_ID_FMT ".",
m_space,
id,
m_index->m_name,
Expand Down
6 changes: 2 additions & 4 deletions storage/innobase/row/row0merge.cc
Expand Up @@ -111,9 +111,8 @@ row_merge_encrypt_buf(
"Unable to encrypt data-block "
" src: %p srclen: %lu buf: %p buflen: %d."
" return-code: %d. Can't continue!\n",
input_buf, (size_t)srv_sort_buf_size,
input_buf, srv_sort_buf_size,
crypted_buf, dstlen, rc);
ut_error;
}
}

Expand Down Expand Up @@ -153,9 +152,8 @@ row_merge_decrypt_buf(
"Unable to encrypt data-block "
" src: %p srclen: %lu buf: %p buflen: %d."
" return-code: %d. Can't continue!\n",
input_buf, (size_t)srv_sort_buf_size,
input_buf, srv_sort_buf_size,
crypted_buf, dstlen, rc);
ut_error;
}

return true;
Expand Down
3 changes: 2 additions & 1 deletion storage/xtradb/buf/buf0buf.cc
Expand Up @@ -5024,7 +5024,8 @@ buf_all_freed_instance(
block->page.space,
block->page.offset);
ib_logf(IB_LOG_LEVEL_ERROR,
"Page oldest_modification %lu fix_count %d io_fix %d.",
"Page oldest_modification " LSN_PF
" fix_count %d io_fix %d.",
block->page.oldest_modification,
block->page.buf_fix_count,
buf_page_get_io_fix(&block->page));
Expand Down
11 changes: 7 additions & 4 deletions storage/xtradb/fil/fil0crypt.cc
Expand Up @@ -473,7 +473,7 @@ fil_parse_write_crypt_data(
4 + // size of key_id
1; // fil_encryption_t

if (end_ptr - ptr < entry_size){
if (ptr + entry_size < end_ptr) {
return NULL;
}

Expand All @@ -499,7 +499,7 @@ fil_parse_write_crypt_data(
fil_encryption_t encryption = (fil_encryption_t)mach_read_from_1(ptr);
ptr +=1;

if (end_ptr - ptr < len) {
if (ptr + len < end_ptr) {
return NULL;
}

Expand Down Expand Up @@ -1479,7 +1479,8 @@ fil_crypt_space_needs_rotation(

bool need_scrubbing =
crypt_data->rotate_state.scrubbing.is_active
&& diff >= srv_background_scrub_data_interval;
&& diff >= 0
&& ulint(diff) >= srv_background_scrub_data_interval;

if (need_key_rotation == false && need_scrubbing == false) {
break;
Expand Down Expand Up @@ -2377,7 +2378,9 @@ DECLARE_THREAD(fil_crypt_thread)(

time_t waited = time(0) - wait_start;

if (waited >= srv_background_scrub_data_check_interval) {
if (waited >= 0
&& ulint(waited)
>= srv_background_scrub_data_check_interval) {
break;
}
}
Expand Down
13 changes: 9 additions & 4 deletions storage/xtradb/lock/lock0lock.cc
Expand Up @@ -930,8 +930,10 @@ lock_reset_lock_and_trx_wait(
}

ib_logf(IB_LOG_LEVEL_INFO,
"Trx id %lu is waiting a lock in statement %s"
" for this trx id %lu and statement %s wait_lock %p",
"Trx id " TRX_ID_FMT
" is waiting a lock in statement %s"
" for this trx id " TRX_ID_FMT
" and statement %s wait_lock %p",
lock->trx->id,
stmt ? stmt : "NULL",
trx_id,
Expand Down Expand Up @@ -2654,7 +2656,8 @@ lock_rec_add_to_queue(
if (wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
if (wsrep_debug) {
fprintf(stderr,
"BF skipping wait: %lu\n",
"BF skipping wait: "
TRX_ID_FMT "\n",
trx->id);
lock_rec_print(stderr, lock);
}
Expand Down Expand Up @@ -5316,7 +5319,9 @@ lock_table_other_has_incompatible(
#ifdef WITH_WSREP
if(wsrep_thd_is_wsrep(trx->mysql_thd)) {
if (wsrep_debug) {
fprintf(stderr, "WSREP: trx %ld table lock abort\n",
fprintf(stderr, "WSREP: trx "
TRX_ID_FMT
" table lock abort\n",
trx->id);
}
trx_mutex_enter(lock->trx);
Expand Down
6 changes: 4 additions & 2 deletions storage/xtradb/log/log0crypt.cc
Expand Up @@ -144,10 +144,12 @@ 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 ]: ", checkpoint_no);
fprintf(stderr,
"InnoDB: redo log checkpoint: %llu [ chk key ]: ",
checkpoint_no);
for (size_t i = 0; i < crypt_info.size(); i++) {
struct crypt_info_t* it = &crypt_info[i];
fprintf(stderr, "[ %lu %u ] ",
fprintf(stderr, "[ %llu %u ] ",
it->checkpoint_no,
it->key_version);
}
Expand Down

0 comments on commit 498f4a8

Please sign in to comment.