Fix InnoDB/XtraDB compilation warnings on 32-bit builds.

This commit is contained in:
Marko Mäkelä 2017-03-09 08:54:07 +02:00
commit 498f4a825b
15 changed files with 97 additions and 69 deletions

View file

@ -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 */

View file

@ -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));

View file

@ -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;
}
@ -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;
}
@ -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;
@ -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;
}
}

View file

@ -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,
@ -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);
}
@ -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);

View file

@ -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);
}

View file

@ -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
@ -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.
@ -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);
}
@ -5359,7 +5361,7 @@ retry:
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);
}
@ -6220,6 +6222,7 @@ 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.
@ -6227,7 +6230,7 @@ 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(
/*=========*/
@ -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) ",
@ -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;
@ -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,
@ -6374,6 +6377,7 @@ os_file_trim(
return (TRUE);
}
#endif /* WIN_ASYNC_IO || LINUX_NATIVE_AIO */
#endif /* !UNIV_HOTBACKUP */
/***********************************************************************//**

View file

@ -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,

View file

@ -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;
}
}
@ -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;

View file

@ -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));

View file

@ -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;
}
@ -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;
}
@ -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;
@ -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;
}
}

View file

@ -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,
@ -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);
}
@ -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);

View file

@ -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);
}

View file

@ -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
@ -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.
@ -5336,7 +5338,7 @@ os_aio_windows_handle(
}
if (slot->type == OS_FILE_WRITE) {
if (!slot->is_log && srv_use_trim && os_fallocate_failed == FALSE) {
if (!slot->is_log && srv_use_trim && !os_fallocate_failed) {
// Deallocate unused blocks from file system
os_file_trim(slot);
}
@ -5432,7 +5434,8 @@ retry:
ut_a(slot->pos < end_pos);
if (slot->type == OS_FILE_WRITE) {
if (!slot->is_log && srv_use_trim && os_fallocate_failed == FALSE) {
if (!slot->is_log && srv_use_trim
&& !os_fallocate_failed) {
// Deallocate unused blocks from file system
os_file_trim(slot);
}
@ -6334,6 +6337,7 @@ 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.
@ -6341,7 +6345,7 @@ 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(
/*=========*/
@ -6386,13 +6390,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) ",
@ -6413,7 +6417,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;
@ -6433,7 +6437,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,
@ -6487,6 +6491,7 @@ os_file_trim(
return (TRUE);
}
#endif /* WIN_ASYNC_IO || LINUX_NATIVE_AIO */
/***********************************************************************//**
Try to get number of bytes per sector from file system.

View file

@ -1874,10 +1874,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,

View file

@ -112,9 +112,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;
}
}
@ -154,9 +153,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);