MDEV-21907: Fix most clang -Wconversion in InnoDB

Declare innodb_purge_threads as 4-byte integer (UINT)
instead of 4-or-8-byte (ULONG) and adjust the documentation string.
This commit is contained in:
Marko Mäkelä 2020-03-10 20:05:17 +02:00
parent 6ec3682371
commit 574d8b2940
66 changed files with 538 additions and 572 deletions

View File

@ -63,9 +63,9 @@ unsigned long crc32_iso3309(unsigned long crc, const unsigned char *buf, unsigne
{ {
#if __GNUC__ >= 4 && defined(__x86_64__) && defined(HAVE_CLMUL_INSTRUCTION) #if __GNUC__ >= 4 && defined(__x86_64__) && defined(HAVE_CLMUL_INSTRUCTION)
if (pclmul_enabled) { if (pclmul_enabled) {
uint32_t crc_accum = crc ^ 0xffffffffL; uint32_t crc_accum = (uint32_t) ~crc;
crc32_intel_pclmul(&crc_accum, buf, len); crc32_intel_pclmul(&crc_accum, buf, len);
return crc_accum ^ 0xffffffffL; return ~crc_accum;
} }
#endif #endif
return crc32(crc, buf, len); return crc32(crc, buf, len);

View File

@ -416,15 +416,6 @@
VARIABLE_COMMENT Dictates rate at which UNDO records are purged. Value N means purge rollback segment(s) on every Nth iteration of purge invocation VARIABLE_COMMENT Dictates rate at which UNDO records are purged. Value N means purge rollback segment(s) on every Nth iteration of purge invocation
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128 NUMERIC_MAX_VALUE 128
@@ -1585,7 +1585,7 @@
SESSION_VALUE NULL
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 4.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 32
@@ -1609,7 +1609,7 @@ @@ -1609,7 +1609,7 @@
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE 56 DEFAULT_VALUE 56

View File

@ -1573,8 +1573,8 @@ VARIABLE_NAME INNODB_PURGE_THREADS
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE 4 DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 4. VARIABLE_COMMENT Number of tasks for purging transaction history
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 32 NUMERIC_MAX_VALUE 32
NUMERIC_BLOCK_SIZE 0 NUMERIC_BLOCK_SIZE 0

View File

@ -1035,7 +1035,7 @@ btr_free_root_check(
@param[in,out] mtr mini-transaction @param[in,out] mtr mini-transaction
@return page number of the created root @return page number of the created root
@retval FIL_NULL if did not succeed */ @retval FIL_NULL if did not succeed */
ulint uint32_t
btr_create( btr_create(
ulint type, ulint type,
fil_space_t* space, fil_space_t* space,
@ -1768,7 +1768,7 @@ void btr_set_instant(buf_block_t* root, const dict_index_t& index, mtr_t* mtr)
} }
break; break;
default: default:
ut_ad(!"wrong page type"); ut_ad("wrong page type" == 0);
/* fall through */ /* fall through */
case FIL_PAGE_INDEX: case FIL_PAGE_INDEX:
ut_ad(!page_is_comp(root->frame) ut_ad(!page_is_comp(root->frame)

View File

@ -691,7 +691,7 @@ bool btr_cur_instant_root_init(dict_index_t* index, const page_t* page)
switch (fil_page_get_type(page)) { switch (fil_page_get_type(page)) {
default: default:
ut_ad(!"wrong page type"); ut_ad("wrong page type" == 0);
return true; return true;
case FIL_PAGE_INDEX: case FIL_PAGE_INDEX:
/* The field PAGE_INSTANT is guaranteed 0 on clustered /* The field PAGE_INSTANT is guaranteed 0 on clustered
@ -4105,7 +4105,7 @@ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index,
case REC_STATUS_NODE_PTR: case REC_STATUS_NODE_PTR:
case REC_STATUS_INFIMUM: case REC_STATUS_INFIMUM:
case REC_STATUS_SUPREMUM: case REC_STATUS_SUPREMUM:
ut_ad(!"wrong record status in update"); ut_ad("wrong record status in update" == 0);
} }
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
@ -5871,7 +5871,7 @@ discard_page:
<< block->page.id << block->page.id
<< " in index " << index->name << " in index " << index->name
<< " of " << index->table->name; << " of " << index->table->name;
ut_ad(!"MDEV-14637"); ut_ad("MDEV-14637" == 0);
} }
} }
} }
@ -6677,8 +6677,8 @@ btr_estimate_number_of_different_key_vals(
*/ */
if (index->stat_index_size > 1) { if (index->stat_index_size > 1) {
n_sample_pages = (srv_stats_transient_sample_pages < index->stat_index_size) ? n_sample_pages = (srv_stats_transient_sample_pages < index->stat_index_size) ?
ut_min(static_cast<ulint>(index->stat_index_size), ut_min(index->stat_index_size,
static_cast<ulint>(log2(index->stat_index_size)*srv_stats_transient_sample_pages)) static_cast<ulint>(log2(index->stat_index_size)*double(srv_stats_transient_sample_pages)))
: index->stat_index_size; : index->stat_index_size;
} }

View File

@ -666,8 +666,9 @@ btr_defragment_n_pages(
max_data_size = optimal_page_size; max_data_size = optimal_page_size;
} }
reserved_space = ut_min((ulint)(optimal_page_size reserved_space = ut_min(static_cast<ulint>(
* (1 - srv_defragment_fill_factor)), static_cast<double>(optimal_page_size)
* (1 - srv_defragment_fill_factor)),
(data_size_per_rec (data_size_per_rec
* srv_defragment_fill_factor_n_recs)); * srv_defragment_fill_factor_n_recs));
optimal_page_size -= reserved_space; optimal_page_size -= reserved_space;

View File

@ -1433,12 +1433,11 @@ static buf_chunk_t* buf_chunk_init(buf_chunk_t* chunk, ulint mem_size)
#ifdef HAVE_LIBNUMA #ifdef HAVE_LIBNUMA
if (srv_numa_interleave) { if (srv_numa_interleave) {
struct bitmask *numa_mems_allowed = numa_get_mems_allowed(); struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
int st = mbind(chunk->mem, chunk->mem_size(), if (mbind(chunk->mem, chunk->mem_size(),
MPOL_INTERLEAVE, MPOL_INTERLEAVE,
numa_mems_allowed->maskp, numa_mems_allowed->maskp,
numa_mems_allowed->size, numa_mems_allowed->size,
MPOL_MF_MOVE); MPOL_MF_MOVE)) {
if (st != 0) {
ib::warn() << "Failed to set NUMA memory policy of" ib::warn() << "Failed to set NUMA memory policy of"
" buffer pool page frames to MPOL_INTERLEAVE" " buffer pool page frames to MPOL_INTERLEAVE"
" (error: " << strerror(errno) << ")."; " (error: " << strerror(errno) << ").";
@ -2427,7 +2426,7 @@ static void buf_pool_resize()
buf_resize_status("Withdrawing blocks to be shrunken."); buf_resize_status("Withdrawing blocks to be shrunken.");
time_t withdraw_started = time(NULL); time_t withdraw_started = time(NULL);
ulint message_interval = 60; double message_interval = 60;
ulint retry_interval = 1; ulint retry_interval = 1;
withdraw_retry: withdraw_retry:
@ -6115,24 +6114,29 @@ void buf_stats_get_pool_info(buf_pool_info_t *pool_info)
pool_info->n_ra_pages_evicted = buf_pool->stat.n_ra_pages_evicted; pool_info->n_ra_pages_evicted = buf_pool->stat.n_ra_pages_evicted;
pool_info->page_made_young_rate = pool_info->page_made_young_rate =
(buf_pool->stat.n_pages_made_young static_cast<double>(buf_pool->stat.n_pages_made_young
- buf_pool->old_stat.n_pages_made_young) / time_elapsed; - buf_pool->old_stat.n_pages_made_young)
/ time_elapsed;
pool_info->page_not_made_young_rate = pool_info->page_not_made_young_rate =
(buf_pool->stat.n_pages_not_made_young static_cast<double>(buf_pool->stat.n_pages_not_made_young
- buf_pool->old_stat.n_pages_not_made_young) / time_elapsed; - buf_pool->old_stat.n_pages_not_made_young)
/ time_elapsed;
pool_info->pages_read_rate = pool_info->pages_read_rate =
(buf_pool->stat.n_pages_read static_cast<double>(buf_pool->stat.n_pages_read
- buf_pool->old_stat.n_pages_read) / time_elapsed; - buf_pool->old_stat.n_pages_read)
/ time_elapsed;
pool_info->pages_created_rate = pool_info->pages_created_rate =
(buf_pool->stat.n_pages_created static_cast<double>(buf_pool->stat.n_pages_created
- buf_pool->old_stat.n_pages_created) / time_elapsed; - buf_pool->old_stat.n_pages_created)
/ time_elapsed;
pool_info->pages_written_rate = pool_info->pages_written_rate =
(buf_pool->stat.n_pages_written static_cast<double>(buf_pool->stat.n_pages_written
- buf_pool->old_stat.n_pages_written) / time_elapsed; - buf_pool->old_stat.n_pages_written)
/ time_elapsed;
pool_info->n_page_get_delta = buf_pool->stat.n_page_gets pool_info->n_page_get_delta = buf_pool->stat.n_page_gets
- buf_pool->old_stat.n_page_gets; - buf_pool->old_stat.n_page_gets;
@ -6150,17 +6154,20 @@ void buf_stats_get_pool_info(buf_pool_info_t *pool_info)
- buf_pool->old_stat.n_pages_not_made_young; - buf_pool->old_stat.n_pages_not_made_young;
} }
pool_info->pages_readahead_rnd_rate = pool_info->pages_readahead_rnd_rate =
(buf_pool->stat.n_ra_pages_read_rnd static_cast<double>(buf_pool->stat.n_ra_pages_read_rnd
- buf_pool->old_stat.n_ra_pages_read_rnd) / time_elapsed; - buf_pool->old_stat.n_ra_pages_read_rnd)
/ time_elapsed;
pool_info->pages_readahead_rate = pool_info->pages_readahead_rate =
(buf_pool->stat.n_ra_pages_read static_cast<double>(buf_pool->stat.n_ra_pages_read
- buf_pool->old_stat.n_ra_pages_read) / time_elapsed; - buf_pool->old_stat.n_ra_pages_read)
/ time_elapsed;
pool_info->pages_evicted_rate = pool_info->pages_evicted_rate =
(buf_pool->stat.n_ra_pages_evicted static_cast<double>(buf_pool->stat.n_ra_pages_evicted
- buf_pool->old_stat.n_ra_pages_evicted) / time_elapsed; - buf_pool->old_stat.n_ra_pages_evicted)
/ time_elapsed;
pool_info->unzip_lru_len = UT_LIST_GET_LEN(buf_pool->unzip_LRU); pool_info->unzip_lru_len = UT_LIST_GET_LEN(buf_pool->unzip_LRU);
@ -6203,8 +6210,10 @@ buf_print_io_instance(
pool_info->lru_len, pool_info->lru_len,
pool_info->old_lru_len, pool_info->old_lru_len,
pool_info->flush_list_len, pool_info->flush_list_len,
(((double) pool_info->flush_list_len) / static_cast<double>(pool_info->flush_list_len)
(pool_info->lru_len + pool_info->free_list_len + 1.0)) * 100.0, / (static_cast<double>(pool_info->lru_len
+ pool_info->free_list_len) + 1.0)
* 100.0,
srv_max_buf_pool_modified_pct, srv_max_buf_pool_modified_pct,
pool_info->n_pend_reads, pool_info->n_pend_reads,
pool_info->n_pending_flush_lru, pool_info->n_pending_flush_lru,
@ -6229,8 +6238,9 @@ buf_print_io_instance(
pool_info->pages_written_rate); pool_info->pages_written_rate);
if (pool_info->n_page_get_delta) { if (pool_info->n_page_get_delta) {
double hit_rate = double(pool_info->page_read_delta) double hit_rate = static_cast<double>(
/ pool_info->n_page_get_delta; pool_info->page_read_delta)
/ static_cast<double>(pool_info->n_page_get_delta);
if (hit_rate > 1) { if (hit_rate > 1) {
hit_rate = 1; hit_rate = 1;
@ -6241,10 +6251,11 @@ buf_print_io_instance(
" young-making rate " ULINTPF " / 1000 not " " young-making rate " ULINTPF " / 1000 not "
ULINTPF " / 1000\n", ULINTPF " / 1000\n",
ulint(1000 * (1 - hit_rate)), ulint(1000 * (1 - hit_rate)),
ulint(1000 * double(pool_info->young_making_delta) ulint(1000
/ pool_info->n_page_get_delta), * double(pool_info->young_making_delta)
/ double(pool_info->n_page_get_delta)),
ulint(1000 * double(pool_info->not_young_making_delta) ulint(1000 * double(pool_info->not_young_making_delta)
/ pool_info->n_page_get_delta)); / double(pool_info->n_page_get_delta)));
} else { } else {
fputs("No buffer pool page gets since the last printout\n", fputs("No buffer pool page gets since the last printout\n",
file); file);

View File

@ -870,8 +870,9 @@ static void buf_tmp_reserve_compression_buf(buf_tmp_buffer_t* slot)
static byte* buf_tmp_page_encrypt(ulint offset, const byte* s, byte* d) static byte* buf_tmp_page_encrypt(ulint offset, const byte* s, byte* d)
{ {
/* Calculate the start offset in a page */ /* Calculate the start offset in a page */
uint srclen= srv_page_size - (FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + uint srclen= static_cast<uint>(srv_page_size) -
FIL_PAGE_FCRC32_CHECKSUM); (FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION +
FIL_PAGE_FCRC32_CHECKSUM);
const byte* src= s + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION; const byte* src= s + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION;
byte* dst= d + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION; byte* dst= d + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION;
@ -2240,9 +2241,9 @@ af_get_pct_for_dirty()
/* 1 + is there to avoid division by zero (in case the buffer /* 1 + is there to avoid division by zero (in case the buffer
pool (including the flush_list) was emptied while we are pool (including the flush_list) was emptied while we are
looking at it) */ looking at it) */
double dirty_pct = double(100 * dirty) double dirty_pct = 100 * static_cast<double>(dirty)
/ (1 + UT_LIST_GET_LEN(buf_pool->LRU) / static_cast<double>(1 + UT_LIST_GET_LEN(buf_pool->LRU)
+ UT_LIST_GET_LEN(buf_pool->free)); + UT_LIST_GET_LEN(buf_pool->free));
ut_a(srv_max_dirty_pages_pct_lwm ut_a(srv_max_dirty_pages_pct_lwm
<= srv_max_buf_pool_modified_pct); <= srv_max_buf_pool_modified_pct);
@ -2276,8 +2277,9 @@ af_get_pct_for_lsn(
{ {
lsn_t max_async_age; lsn_t max_async_age;
lsn_t lsn_age_factor; lsn_t lsn_age_factor;
lsn_t af_lwm = (lsn_t) ((srv_adaptive_flushing_lwm lsn_t af_lwm = static_cast<lsn_t>(
* log_get_capacity()) / 100); srv_adaptive_flushing_lwm
* static_cast<double>(log_get_capacity()) / 100);
if (age < af_lwm) { if (age < af_lwm) {
/* No adaptive flushing. */ /* No adaptive flushing. */
@ -2299,10 +2301,11 @@ af_get_pct_for_lsn(
lsn_age_factor = (age * 100) / max_async_age; lsn_age_factor = (age * 100) / max_async_age;
ut_ad(srv_max_io_capacity >= srv_io_capacity); ut_ad(srv_max_io_capacity >= srv_io_capacity);
return(static_cast<ulint>( return static_cast<ulint>(
((srv_max_io_capacity / srv_io_capacity) (static_cast<double>(srv_max_io_capacity / srv_io_capacity
* (lsn_age_factor * sqrt((double)lsn_age_factor))) * lsn_age_factor)
/ 7.5)); * sqrt(static_cast<double>(lsn_age_factor))
/ 7.5));
} }
/*********************************************************************//** /*********************************************************************//**
@ -2351,7 +2354,7 @@ page_cleaner_flush_pages_recommendation(ulint last_pages_in)
/* We update our variables every srv_flushing_avg_loops /* We update our variables every srv_flushing_avg_loops
iterations to smooth out transition in workload. */ iterations to smooth out transition in workload. */
if (++n_iterations >= srv_flushing_avg_loops if (++n_iterations >= srv_flushing_avg_loops
|| time_elapsed >= srv_flushing_avg_loops) { || time_elapsed >= static_cast<double>(srv_flushing_avg_loops)) {
if (time_elapsed < 1) { if (time_elapsed < 1) {
time_elapsed = 1; time_elapsed = 1;
@ -2360,7 +2363,7 @@ page_cleaner_flush_pages_recommendation(ulint last_pages_in)
avg_page_rate = static_cast<ulint>( avg_page_rate = static_cast<ulint>(
((static_cast<double>(sum_pages) ((static_cast<double>(sum_pages)
/ time_elapsed) / time_elapsed)
+ avg_page_rate) / 2); + static_cast<double>(avg_page_rate)) / 2);
/* How much LSN we have generated since last call. */ /* How much LSN we have generated since last call. */
lsn_rate = static_cast<lsn_t>( lsn_rate = static_cast<lsn_t>(
@ -2481,7 +2484,8 @@ page_cleaner_flush_pages_recommendation(ulint last_pages_in)
pages_for_lsn = std::min<ulint>( pages_for_lsn = std::min<ulint>(
pages_for_lsn, srv_max_io_capacity * 2); pages_for_lsn, srv_max_io_capacity * 2);
n_pages = (PCT_IO(pct_total) + avg_page_rate + pages_for_lsn) / 3; n_pages = (ulint(double(srv_io_capacity) * double(pct_total) / 100.0)
+ avg_page_rate + pages_for_lsn) / 3;
if (n_pages > srv_max_io_capacity) { if (n_pages > srv_max_io_capacity) {
n_pages = srv_max_io_capacity; n_pages = srv_max_io_capacity;
@ -2989,7 +2993,7 @@ static os_thread_ret_t DECLARE_THREAD(buf_flush_page_cleaner)(void*)
} else if (ret_sleep == OS_SYNC_TIME_EXCEEDED) { } else if (ret_sleep == OS_SYNC_TIME_EXCEEDED) {
/* no activity, slept enough */ /* no activity, slept enough */
buf_flush_lists(PCT_IO(100), LSN_MAX, &n_flushed); buf_flush_lists(srv_io_capacity, LSN_MAX, &n_flushed);
n_flushed_last += n_flushed; n_flushed_last += n_flushed;

View File

@ -955,15 +955,17 @@ dict_table_open_on_id(table_id_t table_id, bool dict_locked,
/********************************************************************//** /********************************************************************//**
Looks for column n position in the clustered index. Looks for column n position in the clustered index.
@return position in internal representation of the clustered index */ @return position in internal representation of the clustered index */
ulint unsigned
dict_table_get_nth_col_pos( dict_table_get_nth_col_pos(
/*=======================*/ /*=======================*/
const dict_table_t* table, /*!< in: table */ const dict_table_t* table, /*!< in: table */
ulint n, /*!< in: column number */ ulint n, /*!< in: column number */
ulint* prefix_col_pos) ulint* prefix_col_pos)
{ {
return(dict_index_get_nth_col_pos(dict_table_get_first_index(table), ulint pos= dict_index_get_nth_col_pos(dict_table_get_first_index(table),
n, prefix_col_pos)); n, prefix_col_pos);
DBUG_ASSERT(pos <= dict_index_t::MAX_N_FIELDS);
return static_cast<unsigned>(pos);
} }
/********************************************************************//** /********************************************************************//**

View File

@ -302,7 +302,7 @@ dict_mem_table_add_col(
ulint len) /*!< in: precision */ ulint len) /*!< in: precision */
{ {
dict_col_t* col; dict_col_t* col;
ulint i; unsigned i;
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(!heap == !name); ut_ad(!heap == !name);
@ -370,7 +370,6 @@ dict_mem_table_add_v_col(
ulint num_base) ulint num_base)
{ {
dict_v_col_t* v_col; dict_v_col_t* v_col;
ulint i;
ut_ad(table); ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
@ -378,7 +377,7 @@ dict_mem_table_add_v_col(
ut_ad(prtype & DATA_VIRTUAL); ut_ad(prtype & DATA_VIRTUAL);
i = table->n_v_def++; unsigned i = table->n_v_def++;
table->n_t_def++; table->n_t_def++;
@ -412,7 +411,8 @@ dict_mem_table_add_v_col(
v_col->base_col = NULL; v_col->base_col = NULL;
} }
v_col->num_base = num_base; v_col->num_base = static_cast<unsigned>(num_base)
& dict_index_t::MAX_N_FIELDS;
/* Initialize the index list for virtual columns */ /* Initialize the index list for virtual columns */
ut_ad(v_col->v_indexes.empty()); ut_ad(v_col->v_indexes.empty());
@ -704,8 +704,7 @@ dict_mem_fill_column_struct(
ulint prtype, /*!< in: precise type */ ulint prtype, /*!< in: precise type */
ulint col_len) /*!< in: column length */ ulint col_len) /*!< in: column length */
{ {
ulint mbminlen; unsigned mbminlen, mbmaxlen;
ulint mbmaxlen;
column->ind = (unsigned int) col_pos; column->ind = (unsigned int) col_pos;
column->ord_part = 0; column->ord_part = 0;
@ -1202,7 +1201,7 @@ inline void dict_index_t::reconstruct_fields()
} }
fields = tfields; fields = tfields;
n_core_null_bytes = UT_BITS_IN_BYTES(n_core_null); n_core_null_bytes = static_cast<byte>(UT_BITS_IN_BYTES(n_core_null));
} }
/** Reconstruct dropped or reordered columns. /** Reconstruct dropped or reordered columns.
@ -1326,7 +1325,7 @@ dict_index_t::vers_history_row(
} else { } else {
ib::error() << "foreign constraints: secondary index is out of " ib::error() << "foreign constraints: secondary index is out of "
"sync"; "sync";
ut_ad(!"secondary index is out of sync"); ut_ad("secondary index is out of sync" == 0);
error = true; error = true;
} }
mtr.commit(); mtr.commit();

View File

@ -2247,10 +2247,7 @@ fil_crypt_set_rotation_iops(
/********************************************************************* /*********************************************************************
Adjust encrypt tables Adjust encrypt tables
@param[in] val New setting for innodb-encrypt-tables */ @param[in] val New setting for innodb-encrypt-tables */
UNIV_INTERN void fil_crypt_set_encrypt_tables(ulong val)
void
fil_crypt_set_encrypt_tables(
uint val)
{ {
mutex_enter(&fil_system.mutex); mutex_enter(&fil_system.mutex);
@ -2494,6 +2491,6 @@ bool fil_space_verify_crypt_checksum(const byte* page, ulint zip_size)
|| checksum == buf_calc_page_new_checksum(page); || checksum == buf_calc_page_new_checksum(page);
} }
ut_ad(!"unhandled innodb_checksum_algorithm"); ut_ad("unhandled innodb_checksum_algorithm" == 0);
return false; return false;
} }

View File

@ -86,13 +86,13 @@ static ulint fil_page_compress_low(
byte* out_buf, byte* out_buf,
ulint header_len, ulint header_len,
ulint comp_algo, ulint comp_algo,
ulint comp_level) unsigned comp_level)
{ {
ulint write_size = srv_page_size - header_len; ulint write_size = srv_page_size - header_len;
switch (comp_algo) { switch (comp_algo) {
default: default:
ut_ad(!"unknown compression method"); ut_ad("unknown compression method" == 0);
/* fall through */ /* fall through */
case PAGE_UNCOMPRESSED: case PAGE_UNCOMPRESSED:
return 0; return 0;
@ -211,7 +211,8 @@ static ulint fil_page_compress_for_full_crc32(
ulint write_size = fil_page_compress_low( ulint write_size = fil_page_compress_low(
buf, out_buf, header_len, buf, out_buf, header_len,
fil_space_t::get_compression_algo(flags), comp_level); fil_space_t::get_compression_algo(flags),
static_cast<unsigned>(comp_level));
if (write_size == 0) { if (write_size == 0) {
fail: fail:
@ -459,7 +460,9 @@ static bool fil_page_decompress_low(
return LZ4_decompress_safe( return LZ4_decompress_safe(
reinterpret_cast<const char*>(buf) + header_len, reinterpret_cast<const char*>(buf) + header_len,
reinterpret_cast<char*>(tmp_buf), reinterpret_cast<char*>(tmp_buf),
actual_size, srv_page_size) == int(srv_page_size); static_cast<int>(actual_size),
static_cast<int>(srv_page_size)) ==
static_cast<int>(srv_page_size);
#endif /* HAVE_LZ4 */ #endif /* HAVE_LZ4 */
#ifdef HAVE_LZO #ifdef HAVE_LZO
case PAGE_LZO_ALGORITHM: case PAGE_LZO_ALGORITHM:
@ -488,12 +491,12 @@ static bool fil_page_decompress_low(
#ifdef HAVE_BZIP2 #ifdef HAVE_BZIP2
case PAGE_BZIP2_ALGORITHM: case PAGE_BZIP2_ALGORITHM:
{ {
unsigned int dst_pos = srv_page_size; uint dst_pos = static_cast<uint>(srv_page_size);
return BZ_OK == BZ2_bzBuffToBuffDecompress( return BZ_OK == BZ2_bzBuffToBuffDecompress(
reinterpret_cast<char*>(tmp_buf), reinterpret_cast<char*>(tmp_buf),
&dst_pos, &dst_pos,
reinterpret_cast<char*>(buf) + header_len, reinterpret_cast<char*>(buf) + header_len,
actual_size, 1, 0) static_cast<uint>(actual_size), 1, 0)
&& dst_pos == srv_page_size; && dst_pos == srv_page_size;
} }
#endif /* HAVE_BZIP2 */ #endif /* HAVE_BZIP2 */

View File

@ -160,8 +160,8 @@ inline void xdes_set_free(const buf_block_t &block, xdes_t *descr,
ut_ad(!(~*b & 0xaa)); ut_ad(!(~*b & 0xaa));
/* Clear or set XDES_FREE_BIT. */ /* Clear or set XDES_FREE_BIT. */
byte val= free byte val= free
? *b | 1 << (index & 7) ? static_cast<byte>(*b | 1 << (index & 7))
: *b & ~(1 << (index & 7)); : static_cast<byte>(*b & ~(1 << (index & 7)));
mtr->write<1>(block, b, val); mtr->write<1>(block, b, val);
} }
@ -520,7 +520,7 @@ void fil_space_t::modify_check(const mtr_t& mtr) const
return; return;
} }
ut_ad(!"invalid log mode"); ut_ad("invalid log mode" == 0);
} }
#endif #endif

View File

@ -1280,7 +1280,7 @@ fts_cache_node_add_positions(
} else if (new_size < 48) { } else if (new_size < 48) {
new_size = 48; new_size = 48;
} else { } else {
new_size = (ulint)(1.2 * new_size); new_size = new_size * 6 / 5;
} }
ilist = static_cast<byte*>(ut_malloc_nokey(new_size)); ilist = static_cast<byte*>(ut_malloc_nokey(new_size));
@ -4176,7 +4176,8 @@ fts_sync_commit(
<< ": SYNC time: " << ": SYNC time: "
<< (time(NULL) - sync->start_time) << (time(NULL) - sync->start_time)
<< " secs: elapsed " << " secs: elapsed "
<< (double) n_nodes / elapsed_time << static_cast<double>(n_nodes)
/ static_cast<double>(elapsed_time)
<< " ins/sec"; << " ins/sec";
} }
@ -5268,7 +5269,9 @@ fts_update_doc_id(
clust_index = dict_table_get_first_index(table); clust_index = dict_table_get_first_index(table);
ufield->field_no = dict_col_get_clust_pos(col, clust_index); ufield->field_no = static_cast<unsigned>(
dict_col_get_clust_pos(col, clust_index))
& dict_index_t::MAX_N_FIELDS;
dict_col_copy_type(col, dfield_get_type(&ufield->new_val)); dict_col_copy_type(col, dfield_get_type(&ufield->new_val));
/* It is possible we update record that has /* It is possible we update record that has

View File

@ -3497,8 +3497,9 @@ fts_query_calculate_idf(
word_freq->idf = log10(1.0001); word_freq->idf = log10(1.0001);
} else { } else {
word_freq->idf = log10( word_freq->idf = log10(
total_docs static_cast<double>(total_docs)
/ (double) word_freq->doc_count); / static_cast<double>(
word_freq->doc_count));
} }
} }

View File

@ -1850,5 +1850,6 @@ err_exit:
} }
area /= n_recs; area /= n_recs;
return ha_rows(dict_table_get_n_rows(index->table) * area); return ha_rows(static_cast<double>(dict_table_get_n_rows(index->table))
* area);
} }

View File

@ -1984,8 +1984,8 @@ void
innobase_get_cset_width( innobase_get_cset_width(
/*====================*/ /*====================*/
ulint cset, /*!< in: MySQL charset-collation code */ ulint cset, /*!< in: MySQL charset-collation code */
ulint* mbminlen, /*!< out: minimum length of a char (in bytes) */ unsigned*mbminlen, /*!< out: minimum length of a char (in bytes) */
ulint* mbmaxlen) /*!< out: maximum length of a char (in bytes) */ unsigned*mbmaxlen) /*!< out: maximum length of a char (in bytes) */
{ {
CHARSET_INFO* cs; CHARSET_INFO* cs;
ut_ad(cset <= MAX_CHAR_COLL_NUM); ut_ad(cset <= MAX_CHAR_COLL_NUM);
@ -5402,13 +5402,12 @@ innobase_match_index_columns(
One hidden assumption here is that the index column sequences One hidden assumption here is that the index column sequences
are matched up between those in mysql and InnoDB. */ are matched up between those in mysql and InnoDB. */
for (; key_part != key_end; ++key_part) { for (; key_part != key_end; ++key_part) {
ulint col_type; unsigned is_unsigned;
ibool is_unsigned; auto mtype = innodb_idx_fld->col->mtype;
ulint mtype = innodb_idx_fld->col->mtype;
/* Need to translate to InnoDB column type before /* Need to translate to InnoDB column type before
comparison. */ comparison. */
col_type = get_innobase_type_from_mysql_type( auto col_type = get_innobase_type_from_mysql_type(
&is_unsigned, key_part->field); &is_unsigned, key_part->field);
/* Ignore InnoDB specific system columns. */ /* Ignore InnoDB specific system columns. */
@ -6059,7 +6058,7 @@ no_such_table:
} }
/* Index block size in InnoDB: used by MySQL in query optimization */ /* Index block size in InnoDB: used by MySQL in query optimization */
stats.block_size = srv_page_size; stats.block_size = static_cast<uint>(srv_page_size);
if (m_prebuilt->table == NULL if (m_prebuilt->table == NULL
|| m_prebuilt->table->is_temporary() || m_prebuilt->table->is_temporary()
@ -6274,7 +6273,7 @@ wsrep_innobase_mysql_sort(
int mysql_type, /* in: MySQL type */ int mysql_type, /* in: MySQL type */
uint charset_number, /* in: number of the charset */ uint charset_number, /* in: number of the charset */
unsigned char* str, /* in: data field */ unsigned char* str, /* in: data field */
unsigned int str_length, /* in: data field length, ulint str_length, /* in: data field length,
not UNIV_SQL_NULL */ not UNIV_SQL_NULL */
unsigned int buf_length) /* in: total str buffer length */ unsigned int buf_length) /* in: total str buffer length */
@ -6299,7 +6298,7 @@ wsrep_innobase_mysql_sort(
case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VARCHAR:
{ {
uchar tmp_str[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'}; uchar tmp_str[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
uint tmp_length = REC_VERSION_56_MAX_INDEX_COL_LEN; ulint tmp_length = REC_VERSION_56_MAX_INDEX_COL_LEN;
/* Use the charset number to pick the right charset struct for /* Use the charset number to pick the right charset struct for
the comparison. Since the MySQL function get_charset may be the comparison. Since the MySQL function get_charset may be
@ -6326,13 +6325,13 @@ wsrep_innobase_mysql_sort(
memcpy(tmp_str, str, str_length); memcpy(tmp_str, str, str_length);
tmp_length = charset->strnxfrm(str, str_length, tmp_length = charset->strnxfrm(str, str_length,
str_length, tmp_str, uint(str_length), tmp_str,
tmp_length, 0); tmp_length, 0);
DBUG_ASSERT(tmp_length <= str_length); DBUG_ASSERT(tmp_length <= str_length);
if (wsrep_protocol_version < 3) { if (wsrep_protocol_version < 3) {
tmp_length = charset->strnxfrm( tmp_length = charset->strnxfrm(
str, str_length, str, str_length,
str_length, tmp_str, tmp_length, 0); uint(str_length), tmp_str, tmp_length, 0);
DBUG_ASSERT(tmp_length <= str_length); DBUG_ASSERT(tmp_length <= str_length);
} else { } else {
/* strnxfrm will expand the destination string, /* strnxfrm will expand the destination string,
@ -6341,7 +6340,7 @@ wsrep_innobase_mysql_sort(
*/ */
tmp_length = charset->strnxfrm( tmp_length = charset->strnxfrm(
str, buf_length, str, buf_length,
str_length, tmp_str, str_length, 0); uint(str_length), tmp_str, str_length, 0);
DBUG_ASSERT(tmp_length <= buf_length); DBUG_ASSERT(tmp_length <= buf_length);
ret_length = tmp_length; ret_length = tmp_length;
} }
@ -6568,22 +6567,18 @@ VARCHAR and the new true VARCHAR in >= 5.0.3 by the 'prtype'.
ENUM and SET, and unsigned integer types are 'unsigned types' ENUM and SET, and unsigned integer types are 'unsigned types'
@param[in] f MySQL Field @param[in] f MySQL Field
@return DATA_BINARY, DATA_VARCHAR, ... */ @return DATA_BINARY, DATA_VARCHAR, ... */
ulint unsigned
get_innobase_type_from_mysql_type( get_innobase_type_from_mysql_type(unsigned *unsigned_flag, const Field *field)
ulint* unsigned_flag,
const void* f)
{ {
const class Field* field = reinterpret_cast<const class Field*>(f);
/* The following asserts try to check that the MySQL type code fits in /* The following asserts try to check that the MySQL type code fits in
8 bits: this is used in ibuf and also when DATA_NOT_NULL is ORed to 8 bits: this is used in ibuf and also when DATA_NOT_NULL is ORed to
the type */ the type */
DBUG_ASSERT((ulint)MYSQL_TYPE_STRING < 256); static_assert(MYSQL_TYPE_STRING < 256, "compatibility");
DBUG_ASSERT((ulint)MYSQL_TYPE_VAR_STRING < 256); static_assert(MYSQL_TYPE_VAR_STRING < 256, "compatibility");
DBUG_ASSERT((ulint)MYSQL_TYPE_DOUBLE < 256); static_assert(MYSQL_TYPE_DOUBLE < 256, "compatibility");
DBUG_ASSERT((ulint)MYSQL_TYPE_FLOAT < 256); static_assert(MYSQL_TYPE_FLOAT < 256, "compatibility");
DBUG_ASSERT((ulint)MYSQL_TYPE_DECIMAL < 256); static_assert(MYSQL_TYPE_DECIMAL < 256, "compatibility");
if (field->flags & UNSIGNED_FLAG) { if (field->flags & UNSIGNED_FLAG) {
@ -6688,8 +6683,8 @@ innobase_read_from_2_little_endian(
/*******************************************************************//** /*******************************************************************//**
Stores a key value for a row to a buffer. Stores a key value for a row to a buffer.
@return key value length as stored in buff */ @return key value length as stored in buff */
UNIV_INTERN static
uint uint16_t
wsrep_store_key_val_for_row( wsrep_store_key_val_for_row(
/*=========================*/ /*=========================*/
THD* thd, THD* thd,
@ -6699,7 +6694,7 @@ wsrep_store_key_val_for_row(
format) */ format) */
uint buff_len,/*!< in: buffer length */ uint buff_len,/*!< in: buffer length */
const uchar* record, const uchar* record,
ibool* key_is_null)/*!< out: full key was null */ bool* key_is_null)/*!< out: full key was null */
{ {
KEY* key_info = table->key_info + keynr; KEY* key_info = table->key_info + keynr;
KEY_PART_INFO* key_part = key_info->key_part; KEY_PART_INFO* key_part = key_info->key_part;
@ -6712,19 +6707,19 @@ wsrep_store_key_val_for_row(
DBUG_ENTER("wsrep_store_key_val_for_row"); DBUG_ENTER("wsrep_store_key_val_for_row");
memset(buff, 0, buff_len); memset(buff, 0, buff_len);
*key_is_null = TRUE; *key_is_null = true;
for (; key_part != end; key_part++) { for (; key_part != end; key_part++) {
uchar sorted[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'}; uchar sorted[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
ibool part_is_null = FALSE; bool part_is_null = false;
if (key_part->null_bit) { if (key_part->null_bit) {
if (buff_space > 0) { if (buff_space > 0) {
if (record[key_part->null_offset] if (record[key_part->null_offset]
& key_part->null_bit) { & key_part->null_bit) {
*buff = 1; *buff = 1;
part_is_null = TRUE; part_is_null = true;
} else { } else {
*buff = 0; *buff = 0;
} }
@ -6735,7 +6730,7 @@ wsrep_store_key_val_for_row(
wsrep_thd_query(thd)); wsrep_thd_query(thd));
} }
} }
if (!part_is_null) *key_is_null = FALSE; if (!part_is_null) *key_is_null = false;
field = key_part->field; field = key_part->field;
mysql_type = field->type(); mysql_type = field->type();
@ -6985,7 +6980,7 @@ wsrep_store_key_val_for_row(
ut_a(buff <= buff_start + buff_len); ut_a(buff <= buff_start + buff_len);
DBUG_RETURN((uint)(buff - buff_start)); DBUG_RETURN(static_cast<uint16_t>(buff - buff_start));
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/**************************************************************//** /**************************************************************//**
@ -8053,7 +8048,7 @@ calc_row_difference(
ibool changes_fts_doc_col = FALSE; ibool changes_fts_doc_col = FALSE;
trx_t* const trx = prebuilt->trx; trx_t* const trx = prebuilt->trx;
doc_id_t doc_id = FTS_NULL_DOC_ID; doc_id_t doc_id = FTS_NULL_DOC_ID;
ulint num_v = 0; unsigned num_v = 0;
const bool skip_virtual = ha_innobase::omits_virtual_cols(*table->s); const bool skip_virtual = ha_innobase::omits_virtual_cols(*table->s);
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
@ -8285,9 +8280,11 @@ calc_row_difference(
num_v++; num_v++;
ut_ad(field != table->found_next_number_field); ut_ad(field != table->found_next_number_field);
} else { } else {
ufield->field_no = dict_col_get_clust_pos( ufield->field_no = static_cast<unsigned>(
&prebuilt->table->cols[i - num_v], dict_col_get_clust_pos(
clust_index); &prebuilt->table->cols
[i - num_v],
clust_index));
ufield->old_v_val = NULL; ufield->old_v_val = NULL;
if (field != table->found_next_number_field if (field != table->found_next_number_field
|| dfield_is_null(&ufield->new_val)) { || dfield_is_null(&ufield->new_val)) {
@ -9916,7 +9913,7 @@ wsrep_append_foreign_key(
THD* thd = (THD*)trx->mysql_thd; THD* thd = (THD*)trx->mysql_thd;
ulint rcode = DB_SUCCESS; ulint rcode = DB_SUCCESS;
char cache_key[513] = {'\0'}; char cache_key[513] = {'\0'};
int cache_key_len=0; size_t cache_key_len=0;
if (!wsrep_on(trx->mysql_thd) || if (!wsrep_on(trx->mysql_thd) ||
wsrep_thd_is_local(trx->mysql_thd) == false) { wsrep_thd_is_local(trx->mysql_thd) == false) {
@ -10190,12 +10187,11 @@ ha_innobase::wsrep_append_keys(
} }
if (wsrep_protocol_version == 0) { if (wsrep_protocol_version == 0) {
uint len;
char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
char *key = &keyval[0]; char *key = &keyval[0];
ibool is_null; bool is_null;
len = wsrep_store_key_val_for_row( auto len = wsrep_store_key_val_for_row(
thd, table, 0, key, WSREP_MAX_SUPPORTED_KEY_LENGTH, thd, table, 0, key, WSREP_MAX_SUPPORTED_KEY_LENGTH,
record0, &is_null); record0, &is_null);
@ -10252,15 +10248,15 @@ ha_innobase::wsrep_append_keys(
referenced_by_foreign_key2(tab, idx)) || referenced_by_foreign_key2(tab, idx)) ||
(!tab && referenced_by_foreign_key()))) { (!tab && referenced_by_foreign_key()))) {
ibool is_null0; bool is_null0;
uint len0 = wsrep_store_key_val_for_row( auto len0 = wsrep_store_key_val_for_row(
thd, table, i, key0, thd, table, i, key0,
WSREP_MAX_SUPPORTED_KEY_LENGTH, WSREP_MAX_SUPPORTED_KEY_LENGTH,
record0, &is_null0); record0, &is_null0);
if (record1) { if (record1) {
ibool is_null1; bool is_null1;
uint len1 = wsrep_store_key_val_for_row( auto len1= wsrep_store_key_val_for_row(
thd, table, i, key1, thd, table, i, key1,
WSREP_MAX_SUPPORTED_KEY_LENGTH, WSREP_MAX_SUPPORTED_KEY_LENGTH,
record1, &is_null1); record1, &is_null1);
@ -10393,20 +10389,17 @@ create_table_check_doc_id_col(
wrong type/name/size */ wrong type/name/size */
{ {
for (ulint i = 0; i < form->s->fields; i++) { for (ulint i = 0; i < form->s->fields; i++) {
const Field* field; const Field* field = form->field[i];
ulint col_type;
ulint col_len;
ulint unsigned_type;
field = form->field[i];
if (!field->stored_in_db()) { if (!field->stored_in_db()) {
continue; continue;
} }
col_type = get_innobase_type_from_mysql_type( unsigned unsigned_type;
auto col_type = get_innobase_type_from_mysql_type(
&unsigned_type, field); &unsigned_type, field);
col_len = field->pack_length(); auto col_len = field->pack_length();
if (innobase_strcasecmp(field->field_name.str, if (innobase_strcasecmp(field->field_name.str,
FTS_DOC_ID_COL_NAME) == 0) { FTS_DOC_ID_COL_NAME) == 0) {
@ -10484,7 +10477,7 @@ innodb_base_col_setup(
const Field* field, const Field* field,
dict_v_col_t* v_col) dict_v_col_t* v_col)
{ {
ulint n = 0; unsigned n = 0;
prepare_vcol_for_base_setup(table, field, v_col); prepare_vcol_for_base_setup(table, field, v_col);
@ -10561,10 +10554,8 @@ int
create_table_info_t::create_table_def() create_table_info_t::create_table_def()
{ {
dict_table_t* table; dict_table_t* table;
ulint col_type;
ulint col_len;
ulint nulls_allowed; ulint nulls_allowed;
ulint unsigned_type; unsigned unsigned_type;
ulint binary_type; ulint binary_type;
ulint long_true_varchar; ulint long_true_varchar;
ulint charset_no; ulint charset_no;
@ -10669,7 +10660,7 @@ create_table_info_t::create_table_def()
} }
} }
col_type = get_innobase_type_from_mysql_type( auto col_type = get_innobase_type_from_mysql_type(
&unsigned_type, field); &unsigned_type, field);
if (!col_type) { if (!col_type) {
@ -10682,7 +10673,11 @@ create_table_info_t::create_table_def()
" the table with an appropriate" " the table with an appropriate"
" column type.", " column type.",
table->name.m_name, field->field_name.str); table->name.m_name, field->field_name.str);
goto err_col; err_col:
dict_mem_table_free(table);
mem_heap_free(heap);
ut_ad(trx_state_eq(m_trx, TRX_STATE_NOT_STARTED));
DBUG_RETURN(HA_ERR_GENERIC);
} }
nulls_allowed = field->real_maybe_null() ? 0 : DATA_NOT_NULL; nulls_allowed = field->real_maybe_null() ? 0 : DATA_NOT_NULL;
@ -10715,7 +10710,7 @@ create_table_info_t::create_table_def()
} }
} }
col_len = field->pack_length(); auto col_len = field->pack_length();
/* The MySQL pack length contains 1 or 2 bytes length field /* The MySQL pack length contains 1 or 2 bytes length field
for a true VARCHAR. Let us subtract that, so that the InnoDB for a true VARCHAR. Let us subtract that, so that the InnoDB
@ -10737,11 +10732,7 @@ create_table_info_t::create_table_def()
if (dict_col_name_is_reserved(field->field_name.str)){ if (dict_col_name_is_reserved(field->field_name.str)){
my_error(ER_WRONG_COLUMN_NAME, MYF(0), my_error(ER_WRONG_COLUMN_NAME, MYF(0),
field->field_name.str); field->field_name.str);
err_col: goto err_col;
dict_mem_table_free(table);
mem_heap_free(heap);
ut_ad(trx_state_eq(m_trx, TRX_STATE_NOT_STARTED));
DBUG_RETURN(HA_ERR_GENERIC);
} }
ulint is_virtual = !field->stored_in_db() ? DATA_VIRTUAL : 0; ulint is_virtual = !field->stored_in_db() ? DATA_VIRTUAL : 0;
@ -10973,8 +10964,7 @@ create_index(
for (ulint i = 0; i < key->user_defined_key_parts; i++) { for (ulint i = 0; i < key->user_defined_key_parts; i++) {
KEY_PART_INFO* key_part = key->key_part + i; KEY_PART_INFO* key_part = key->key_part + i;
ulint prefix_len; ulint prefix_len;
ulint col_type; unsigned is_unsigned;
ulint is_unsigned;
/* (The flag HA_PART_KEY_SEG denotes in MySQL a /* (The flag HA_PART_KEY_SEG denotes in MySQL a
@ -10994,7 +10984,7 @@ create_index(
const char* field_name = key_part->field->field_name.str; const char* field_name = key_part->field->field_name.str;
col_type = get_innobase_type_from_mysql_type( auto col_type = get_innobase_type_from_mysql_type(
&is_unsigned, key_part->field); &is_unsigned, key_part->field);
if (DATA_LARGE_MTYPE(col_type) if (DATA_LARGE_MTYPE(col_type)
@ -11771,7 +11761,7 @@ index_bad:
@param[in] str string which might include 'MERGE_THRESHOLD=' @param[in] str string which might include 'MERGE_THRESHOLD='
@return value parsed. 0 means not found or invalid value. */ @return value parsed. 0 means not found or invalid value. */
static static
ulint unsigned
innobase_parse_merge_threshold( innobase_parse_merge_threshold(
THD* thd, THD* thd,
const char* str) const char* str)
@ -11791,7 +11781,7 @@ innobase_parse_merge_threshold(
lint ret = atoi(pos); lint ret = atoi(pos);
if (ret > 0 && ret <= 50) { if (ret > 0 && ret <= 50) {
return(static_cast<ulint>(ret)); return(static_cast<unsigned>(ret));
} }
push_warning_printf( push_warning_printf(
@ -11814,8 +11804,8 @@ innobase_parse_hint_from_comment(
dict_table_t* table, dict_table_t* table,
const TABLE_SHARE* table_share) const TABLE_SHARE* table_share)
{ {
ulint merge_threshold_table; unsigned merge_threshold_table;
ulint merge_threshold_index[MAX_KEY]; unsigned merge_threshold_index[MAX_KEY];
bool is_found[MAX_KEY]; bool is_found[MAX_KEY];
if (table_share->comment.str != NULL) { if (table_share->comment.str != NULL) {
@ -12134,7 +12124,7 @@ foreign_push_index_error(trx_t* trx, const char* operation,
col_name); col_name);
return; return;
} }
DBUG_ASSERT(!"unknown error"); DBUG_ASSERT("unknown error" == 0);
} }
/** Find column or virtual column in table by its name. /** Find column or virtual column in table by its name.
@ -13798,8 +13788,8 @@ int ha_innobase::truncate()
HA_CREATE_INFO info; HA_CREATE_INFO info;
mem_heap_t* heap = mem_heap_create(1000); mem_heap_t* heap = mem_heap_create(1000);
dict_table_t* ib_table = m_prebuilt->table; dict_table_t* ib_table = m_prebuilt->table;
const time_t update_time = ib_table->update_time; const auto update_time = ib_table->update_time;
const ulint stored_lock = m_prebuilt->stored_select_lock_type; const auto stored_lock = m_prebuilt->stored_select_lock_type;
info.init(); info.init();
update_create_info_from_table(&info, table); update_create_info_from_table(&info, table);
@ -14361,11 +14351,12 @@ innodb_rec_per_key(
rec_per_key calculation */ rec_per_key calculation */
rec_per_key rec_per_key
= static_cast<rec_per_key_t>(records - n_null) = static_cast<rec_per_key_t>(records - n_null)
/ (n_diff - n_null); / static_cast<rec_per_key_t>(n_diff - n_null);
} }
} else { } else {
DEBUG_SYNC_C("after_checking_for_0"); DEBUG_SYNC_C("after_checking_for_0");
rec_per_key = static_cast<rec_per_key_t>(records) / n_diff; rec_per_key = static_cast<rec_per_key_t>(records)
/ static_cast<rec_per_key_t>(n_diff);
} }
if (rec_per_key < 1.0) { if (rec_per_key < 1.0) {
@ -14571,7 +14562,6 @@ ha_innobase::info_low(
} }
if (flag & HA_STATUS_CONST) { if (flag & HA_STATUS_CONST) {
ulong i;
/* Verify the number of index in InnoDB and MySQL /* Verify the number of index in InnoDB and MySQL
matches up. If m_prebuilt->clust_index_was_generated matches up. If m_prebuilt->clust_index_was_generated
holds, InnoDB defines GEN_CLUST_INDEX internally */ holds, InnoDB defines GEN_CLUST_INDEX internally */
@ -14620,7 +14610,7 @@ ha_innobase::info_low(
ut_a(ib_table->stat_initialized); ut_a(ib_table->stat_initialized);
for (i = 0; i < table->s->keys; i++) { for (uint i = 0; i < table->s->keys; i++) {
ulong j; ulong j;
dict_index_t* index = innobase_get_index(i); dict_index_t* index = innobase_get_index(i);
@ -18988,14 +18978,9 @@ wsrep_abort_slave_trx(
} }
/*******************************************************************//** /*******************************************************************//**
This function is used to kill one transaction in BF. */ This function is used to kill one transaction in BF. */
UNIV_INTERN
int int
wsrep_innobase_kill_one_trx( wsrep_innobase_kill_one_trx(THD *bf_thd_ptr, const trx_t *bf_trx,
/*========================*/ trx_t *victim_trx, bool signal)
void * const bf_thd_ptr,
const trx_t * const bf_trx,
trx_t *victim_trx,
ibool signal)
{ {
ut_ad(lock_mutex_own()); ut_ad(lock_mutex_own());
ut_ad(trx_mutex_own(victim_trx)); ut_ad(trx_mutex_own(victim_trx));
@ -19244,14 +19229,10 @@ static MYSQL_SYSVAR_ULONG(purge_batch_size, srv_purge_batch_size,
1, /* Minimum value */ 1, /* Minimum value */
5000, 0); /* Maximum value */ 5000, 0); /* Maximum value */
static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads, static MYSQL_SYSVAR_UINT(purge_threads, srv_n_purge_threads,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Purge threads can be from 1 to 32. Default is 4.", "Number of tasks for purging transaction history",
NULL, NULL, NULL, NULL, 4, 1, 32, 0);
4, /* Default setting */
1, /* Minimum value */
srv_max_purge_threads,/* Maximum value */
0);
static MYSQL_SYSVAR_ULONG(sync_array_size, srv_sync_array_size, static MYSQL_SYSVAR_ULONG(sync_array_size, srv_sync_array_size,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,

View File

@ -338,7 +338,7 @@ found_nullable:
goto found_j; goto found_j;
} }
} }
DBUG_ASSERT(!"no such col"); DBUG_ASSERT("no such col" == 0);
found_j: found_j:
std::swap(index.fields[j], std::swap(index.fields[j],
index.fields[k]); index.fields[k]);
@ -497,7 +497,7 @@ inline bool dict_table_t::instant_column(const dict_table_t& table,
/* Preserve the default values of previously instantly added /* Preserve the default values of previously instantly added
columns, or copy the new default values to this->heap. */ columns, or copy the new default values to this->heap. */
for (ulint i = 0; i < ulint(table.n_cols); i++) { for (unsigned i = 0; i < table.n_cols; i++) {
dict_col_t& c = cols[i]; dict_col_t& c = cols[i];
if (const dict_col_t* o = find(old_cols, col_map, n_cols, i)) { if (const dict_col_t* o = find(old_cols, col_map, n_cols, i)) {
@ -866,12 +866,12 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
/** whether the order of the clustered index is unchanged */ /** whether the order of the clustered index is unchanged */
bool skip_pk_sort; bool skip_pk_sort;
/** number of virtual columns to be added */ /** number of virtual columns to be added */
ulint num_to_add_vcol; unsigned num_to_add_vcol;
/** virtual columns to be added */ /** virtual columns to be added */
dict_v_col_t* add_vcol; dict_v_col_t* add_vcol;
const char** add_vcol_name; const char** add_vcol_name;
/** number of virtual columns to be dropped */ /** number of virtual columns to be dropped */
ulint num_to_drop_vcol; unsigned num_to_drop_vcol;
/** virtual columns to be dropped */ /** virtual columns to be dropped */
dict_v_col_t* drop_vcol; dict_v_col_t* drop_vcol;
const char** drop_vcol_name; const char** drop_vcol_name;
@ -2021,7 +2021,7 @@ ha_innobase::check_if_supported_inplace_alter(
const Field* field = table->field[i]; const Field* field = table->field[i];
const dict_col_t* col = dict_table_get_nth_col( const dict_col_t* col = dict_table_get_nth_col(
m_prebuilt->table, icol); m_prebuilt->table, icol);
ulint unsigned_flag; unsigned unsigned_flag;
if (!field->stored_in_db()) { if (!field->stored_in_db()) {
continue; continue;
@ -3348,7 +3348,7 @@ name_ok:
= key.key_part[i]; = key.key_part[i];
const Field* field const Field* field
= key_part1.field; = key_part1.field;
ibool is_unsigned; unsigned is_unsigned;
switch (get_innobase_type_from_mysql_type( switch (get_innobase_type_from_mysql_type(
&is_unsigned, field)) { &is_unsigned, field)) {
@ -3417,9 +3417,8 @@ innobase_create_index_field_def(
index_field_t* index_field) index_field_t* index_field)
{ {
const Field* field; const Field* field;
ibool is_unsigned; unsigned is_unsigned;
ulint col_type; unsigned num_v = 0;
ulint num_v = 0;
DBUG_ENTER("innobase_create_index_field_def"); DBUG_ENTER("innobase_create_index_field_def");
@ -3433,7 +3432,7 @@ innobase_create_index_field_def(
} }
} }
col_type = get_innobase_type_from_mysql_type( auto col_type = get_innobase_type_from_mysql_type(
&is_unsigned, field); &is_unsigned, field);
if ((index_field->is_v_col = !field->stored_in_db())) { if ((index_field->is_v_col = !field->stored_in_db())) {
@ -4768,8 +4767,7 @@ prepare_inplace_add_virtual(
const TABLE* table) const TABLE* table)
{ {
ha_innobase_inplace_ctx* ctx; ha_innobase_inplace_ctx* ctx;
ulint i = 0; unsigned i = 0, j = 0;
ulint j = 0;
ctx = static_cast<ha_innobase_inplace_ctx*> ctx = static_cast<ha_innobase_inplace_ctx*>
(ha_alter_info->handler_ctx); (ha_alter_info->handler_ctx);
@ -4792,14 +4790,12 @@ prepare_inplace_add_virtual(
continue; continue;
} }
ulint is_unsigned; unsigned is_unsigned;
ulint charset_no; auto col_type = get_innobase_type_from_mysql_type(
ulint col_type &is_unsigned, field);
= get_innobase_type_from_mysql_type(
&is_unsigned, field);
ulint col_len = field->pack_length(); auto col_len = field->pack_length();
ulint field_type = (ulint) field->type(); unsigned field_type = field->type() | is_unsigned;
if (!field->real_maybe_null()) { if (!field->real_maybe_null()) {
field_type |= DATA_NOT_NULL; field_type |= DATA_NOT_NULL;
@ -4809,12 +4805,10 @@ prepare_inplace_add_virtual(
field_type |= DATA_BINARY_TYPE; field_type |= DATA_BINARY_TYPE;
} }
if (is_unsigned) { unsigned charset_no;
field_type |= DATA_UNSIGNED;
}
if (dtype_is_string_type(col_type)) { if (dtype_is_string_type(col_type)) {
charset_no = (ulint) field->charset()->number; charset_no = field->charset()->number;
DBUG_EXECUTE_IF( DBUG_EXECUTE_IF(
"ib_alter_add_virtual_fail", "ib_alter_add_virtual_fail",
@ -4879,8 +4873,7 @@ prepare_inplace_drop_virtual(
const TABLE* table) const TABLE* table)
{ {
ha_innobase_inplace_ctx* ctx; ha_innobase_inplace_ctx* ctx;
ulint i = 0; unsigned i = 0, j = 0;
ulint j = 0;
ctx = static_cast<ha_innobase_inplace_ctx*> ctx = static_cast<ha_innobase_inplace_ctx*>
(ha_alter_info->handler_ctx); (ha_alter_info->handler_ctx);
@ -4906,17 +4899,13 @@ prepare_inplace_drop_virtual(
continue; continue;
} }
ulint col_len; unsigned is_unsigned;
ulint is_unsigned;
ulint field_type;
ulint charset_no;
ulint col_type auto col_type = get_innobase_type_from_mysql_type(
= get_innobase_type_from_mysql_type( &is_unsigned, field);
&is_unsigned, field);
col_len = field->pack_length(); auto col_len = field->pack_length();
field_type = (ulint) field->type(); unsigned field_type = field->type() | is_unsigned;
if (!field->real_maybe_null()) { if (!field->real_maybe_null()) {
field_type |= DATA_NOT_NULL; field_type |= DATA_NOT_NULL;
@ -4926,12 +4915,10 @@ prepare_inplace_drop_virtual(
field_type |= DATA_BINARY_TYPE; field_type |= DATA_BINARY_TYPE;
} }
if (is_unsigned) { unsigned charset_no = 0;
field_type |= DATA_UNSIGNED;
}
if (dtype_is_string_type(col_type)) { if (dtype_is_string_type(col_type)) {
charset_no = (ulint) field->charset()->number; charset_no = field->charset()->number;
DBUG_EXECUTE_IF( DBUG_EXECUTE_IF(
"ib_alter_add_virtual_fail", "ib_alter_add_virtual_fail",
@ -5100,7 +5087,7 @@ static bool innobase_add_one_virtual(
return true; return true;
} }
for (ulint i = 0; i < unsigned{vcol->num_base}; i++) { for (unsigned i = 0; i < vcol->num_base; i++) {
if (innobase_insert_sys_virtual( if (innobase_insert_sys_virtual(
table, pos, vcol->base_col[i]->ind, trx)) { table, pos, vcol->base_col[i]->ind, trx)) {
return true; return true;
@ -5373,7 +5360,7 @@ innobase_drop_virtual_try(
ctx = static_cast<ha_innobase_inplace_ctx*> ctx = static_cast<ha_innobase_inplace_ctx*>
(ha_alter_info->handler_ctx); (ha_alter_info->handler_ctx);
for (ulint i = 0; i < ctx->num_to_drop_vcol; i++) { for (unsigned i = 0; i < ctx->num_to_drop_vcol; i++) {
ulint pos = dict_create_v_col_pos( ulint pos = dict_create_v_col_pos(
ctx->drop_vcol[i].v_pos - i, ctx->drop_vcol[i].v_pos - i,
@ -5733,7 +5720,7 @@ add_all_virtual:
&mtr); &mtr);
DBUG_ASSERT(root); DBUG_ASSERT(root);
if (fil_page_get_type(root->frame) != FIL_PAGE_TYPE_INSTANT) { if (fil_page_get_type(root->frame) != FIL_PAGE_TYPE_INSTANT) {
DBUG_ASSERT(!"wrong page type"); DBUG_ASSERT("wrong page type" == 0);
err = DB_CORRUPTION; err = DB_CORRUPTION;
goto func_exit; goto func_exit;
} }
@ -5822,7 +5809,7 @@ empty_table:
index->set_modified(mtr); index->set_modified(mtr);
if (buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, &mtr)) { if (buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, &mtr)) {
if (fil_page_get_type(root->frame) != FIL_PAGE_INDEX) { if (fil_page_get_type(root->frame) != FIL_PAGE_INDEX) {
DBUG_ASSERT(!"wrong page type"); DBUG_ASSERT("wrong page type" == 0);
goto err_exit; goto err_exit;
} }
@ -6046,7 +6033,7 @@ prepare_inplace_alter_table_dict(
for (ulint i = 0; i < ctx->num_to_add_vcol; i++) { for (ulint i = 0; i < ctx->num_to_add_vcol; i++) {
/* Set mbminmax for newly added column */ /* Set mbminmax for newly added column */
dict_col_t& col = ctx->add_vcol[i].m_col; dict_col_t& col = ctx->add_vcol[i].m_col;
ulint mbminlen, mbmaxlen; unsigned mbminlen, mbmaxlen;
dtype_get_mblen(col.mtype, col.prtype, dtype_get_mblen(col.mtype, col.prtype,
&mbminlen, &mbmaxlen); &mbminlen, &mbmaxlen);
col.mbminlen = mbminlen; col.mbminlen = mbminlen;
@ -6242,15 +6229,11 @@ new_clustered_failed:
for (uint i = 0; i < altered_table->s->fields; i++) { for (uint i = 0; i < altered_table->s->fields; i++) {
const Field* field = altered_table->field[i]; const Field* field = altered_table->field[i];
ulint is_unsigned; unsigned is_unsigned;
ulint field_type auto col_type = get_innobase_type_from_mysql_type(
= (ulint) field->type(); &is_unsigned, field);
ulint col_type unsigned field_type = field->type() | is_unsigned;
= get_innobase_type_from_mysql_type( const bool is_virtual = !field->stored_in_db();
&is_unsigned, field);
ulint charset_no;
ulint col_len;
const bool is_virtual = !field->stored_in_db();
/* we assume in dtype_form_prtype() that this /* we assume in dtype_form_prtype() that this
fits in two bytes */ fits in two bytes */
@ -6264,10 +6247,6 @@ new_clustered_failed:
field_type |= DATA_BINARY_TYPE; field_type |= DATA_BINARY_TYPE;
} }
if (is_unsigned) {
field_type |= DATA_UNSIGNED;
}
if (altered_table->versioned()) { if (altered_table->versioned()) {
if (i == altered_table->s->vers.start_fieldno) { if (i == altered_table->s->vers.start_fieldno) {
field_type |= DATA_VERS_START; field_type |= DATA_VERS_START;
@ -6280,8 +6259,10 @@ new_clustered_failed:
} }
} }
unsigned charset_no;
if (dtype_is_string_type(col_type)) { if (dtype_is_string_type(col_type)) {
charset_no = (ulint) field->charset()->number; charset_no = field->charset()->number;
if (charset_no > MAX_CHAR_COLL_NUM) { if (charset_no > MAX_CHAR_COLL_NUM) {
my_error(ER_WRONG_KEY_COLUMN, MYF(0), "InnoDB", my_error(ER_WRONG_KEY_COLUMN, MYF(0), "InnoDB",
@ -6292,7 +6273,7 @@ new_clustered_failed:
charset_no = 0; charset_no = 0;
} }
col_len = field->pack_length(); auto col_len = field->pack_length();
/* The MySQL pack length contains 1 or 2 bytes /* The MySQL pack length contains 1 or 2 bytes
length field for a true VARCHAR. Let us length field for a true VARCHAR. Let us
@ -8983,7 +8964,7 @@ processed_field:
} }
/** Convert field type and length to InnoDB format */ /** Convert field type and length to InnoDB format */
static void get_type(const Field& f, ulint& prtype, ulint& mtype, ulint& len) static void get_type(const Field& f, uint& prtype, uint& mtype, uint& len)
{ {
mtype = get_innobase_type_from_mysql_type(&prtype, &f); mtype = get_innobase_type_from_mysql_type(&prtype, &f);
len = f.pack_length(); len = f.pack_length();
@ -9052,7 +9033,7 @@ innobase_rename_or_enlarge_column_try(
n_base = 0; n_base = 0;
} }
ulint prtype, mtype, len; unsigned prtype, mtype, len;
get_type(f, prtype, mtype, len); get_type(f, prtype, mtype, len);
DBUG_ASSERT(!dtype_is_string_type(col->mtype) DBUG_ASSERT(!dtype_is_string_type(col->mtype)
|| col->mbminlen == f.charset()->mbminlen); || col->mbminlen == f.charset()->mbminlen);
@ -9206,7 +9187,7 @@ innobase_rename_or_enlarge_columns_cache(
DBUG_ASSERT(col->mbminlen DBUG_ASSERT(col->mbminlen
== (is_string == (is_string
? (*af)->charset()->mbminlen : 0)); ? (*af)->charset()->mbminlen : 0));
ulint prtype, mtype, len; unsigned prtype, mtype, len;
get_type(**af, prtype, mtype, len); get_type(**af, prtype, mtype, len);
DBUG_ASSERT(is_string == dtype_is_string_type(mtype)); DBUG_ASSERT(is_string == dtype_is_string_type(mtype));
@ -10091,9 +10072,9 @@ commit_try_norebuild(
DBUG_RETURN(true); DBUG_RETURN(true);
} }
ulint n_col = unsigned(ctx->old_table->n_cols) unsigned n_col = ctx->old_table->n_cols
- DATA_N_SYS_COLS; - DATA_N_SYS_COLS;
ulint n_v_col = unsigned(ctx->old_table->n_v_cols) unsigned n_v_col = ctx->old_table->n_v_cols
+ ctx->num_to_add_vcol - ctx->num_to_drop_vcol; + ctx->num_to_add_vcol - ctx->num_to_drop_vcol;
if (innodb_update_cols( if (innodb_update_cols(

View File

@ -2112,7 +2112,8 @@ i_s_metrics_fill(
if (time_diff != 0) { if (time_diff != 0) {
OK(fields[METRIC_AVG_VALUE_RESET]->store( OK(fields[METRIC_AVG_VALUE_RESET]->store(
static_cast<double>( static_cast<double>(
MONITOR_VALUE(count) / time_diff))); MONITOR_VALUE(count))
/ time_diff));
fields[METRIC_AVG_VALUE_RESET]->set_notnull(); fields[METRIC_AVG_VALUE_RESET]->set_notnull();
} else { } else {
fields[METRIC_AVG_VALUE_RESET]->set_null(); fields[METRIC_AVG_VALUE_RESET]->set_null();

View File

@ -2554,7 +2554,7 @@ ulint ibuf_merge_all()
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
ulint sum_bytes = 0; ulint sum_bytes = 0;
ulint n_pages = PCT_IO(100); ulint n_pages = srv_io_capacity;
for (ulint sum_pages = 0; sum_pages < n_pages; ) { for (ulint sum_pages = 0; sum_pages < n_pages; ) {
ulint n_pag2; ulint n_pag2;

View File

@ -337,7 +337,7 @@ btr_node_ptr_get_child_page_no(
@param[in,out] mtr mini-transaction @param[in,out] mtr mini-transaction
@return page number of the created root @return page number of the created root
@retval FIL_NULL if did not succeed */ @retval FIL_NULL if did not succeed */
ulint uint32_t
btr_create( btr_create(
ulint type, ulint type,
fil_space_t* space, fil_space_t* space,

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -330,9 +330,9 @@ dtype_get_mblen(
/*============*/ /*============*/
ulint mtype, /*!< in: main type */ ulint mtype, /*!< in: main type */
ulint prtype, /*!< in: precise type (and collation) */ ulint prtype, /*!< in: precise type (and collation) */
ulint* mbminlen, /*!< out: minimum length of a unsigned* mbminlen, /*!< out: minimum length of a
multi-byte character */ multi-byte character */
ulint* mbmaxlen); /*!< out: maximum length of a unsigned* mbmaxlen); /*!< out: maximum length of a
multi-byte character */ multi-byte character */
/** /**
Get the charset-collation code for string types. Get the charset-collation code for string types.
@ -399,7 +399,7 @@ dtype_get_mbmaxlen(
Returns the size of a fixed size data type, 0 if not a fixed size type. Returns the size of a fixed size data type, 0 if not a fixed size type.
@return fixed size, or 0 */ @return fixed size, or 0 */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dtype_get_fixed_size_low( dtype_get_fixed_size_low(
/*=====================*/ /*=====================*/
ulint mtype, /*!< in: main type */ ulint mtype, /*!< in: main type */
@ -415,7 +415,7 @@ dtype_get_fixed_size_low(
Returns the minimum size of a data type. Returns the minimum size of a data type.
@return minimum size */ @return minimum size */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dtype_get_min_size_low( dtype_get_min_size_low(
/*===================*/ /*===================*/
ulint mtype, /*!< in: main type */ ulint mtype, /*!< in: main type */

View File

@ -72,9 +72,9 @@ dtype_get_mblen(
/*============*/ /*============*/
ulint mtype, /*!< in: main type */ ulint mtype, /*!< in: main type */
ulint prtype, /*!< in: precise type (and collation) */ ulint prtype, /*!< in: precise type (and collation) */
ulint* mbminlen, /*!< out: minimum length of a unsigned*mbminlen, /*!< out: minimum length of a
multi-byte character */ multi-byte character */
ulint* mbmaxlen) /*!< out: maximum length of a unsigned*mbmaxlen) /*!< out: maximum length of a
multi-byte character */ multi-byte character */
{ {
if (dtype_is_string_type(mtype)) { if (dtype_is_string_type(mtype)) {
@ -96,12 +96,11 @@ dtype_set_mblen(
/*============*/ /*============*/
dtype_t* type) /*!< in/out: type */ dtype_t* type) /*!< in/out: type */
{ {
ulint mbminlen; unsigned mbminlen, mbmaxlen;
ulint mbmaxlen;
dtype_get_mblen(type->mtype, type->prtype, &mbminlen, &mbmaxlen); dtype_get_mblen(type->mtype, type->prtype, &mbminlen, &mbmaxlen);
type->mbminlen = mbminlen; type->mbminlen = mbminlen & 7;
type->mbmaxlen = mbmaxlen; type->mbmaxlen = mbmaxlen & 7;
ut_ad(dtype_validate(type)); ut_ad(dtype_validate(type));
} }
@ -429,7 +428,7 @@ dtype_sql_name(
Returns the size of a fixed size data type, 0 if not a fixed size type. Returns the size of a fixed size data type, 0 if not a fixed size type.
@return fixed size, or 0 */ @return fixed size, or 0 */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dtype_get_fixed_size_low( dtype_get_fixed_size_low(
/*=====================*/ /*=====================*/
ulint mtype, /*!< in: main type */ ulint mtype, /*!< in: main type */
@ -465,15 +464,15 @@ dtype_get_fixed_size_low(
case DATA_INT: case DATA_INT:
case DATA_FLOAT: case DATA_FLOAT:
case DATA_DOUBLE: case DATA_DOUBLE:
return(len); return static_cast<unsigned>(len);
case DATA_MYSQL: case DATA_MYSQL:
if (prtype & DATA_BINARY_TYPE) { if (prtype & DATA_BINARY_TYPE) {
return(len); return static_cast<unsigned>(len);
} else if (!comp) { } else if (!comp) {
return(len); return static_cast<unsigned>(len);
} else { } else {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ulint i_mbminlen, i_mbmaxlen; unsigned i_mbminlen, i_mbmaxlen;
innobase_get_cset_width( innobase_get_cset_width(
dtype_get_charset_coll(prtype), dtype_get_charset_coll(prtype),
@ -483,7 +482,7 @@ dtype_get_fixed_size_low(
ut_ad(i_mbmaxlen == mbmaxlen); ut_ad(i_mbmaxlen == mbmaxlen);
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
if (mbminlen == mbmaxlen) { if (mbminlen == mbmaxlen) {
return(len); return static_cast<unsigned>(len);
} }
} }
/* Treat as variable-length. */ /* Treat as variable-length. */
@ -506,7 +505,7 @@ dtype_get_fixed_size_low(
Returns the minimum size of a data type. Returns the minimum size of a data type.
@return minimum size */ @return minimum size */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dtype_get_min_size_low( dtype_get_min_size_low(
/*===================*/ /*===================*/
ulint mtype, /*!< in: main type */ ulint mtype, /*!< in: main type */
@ -539,20 +538,21 @@ dtype_get_min_size_low(
case DATA_INT: case DATA_INT:
case DATA_FLOAT: case DATA_FLOAT:
case DATA_DOUBLE: case DATA_DOUBLE:
return(len); return static_cast<unsigned>(len);
case DATA_MYSQL: case DATA_MYSQL:
if (prtype & DATA_BINARY_TYPE) { if (prtype & DATA_BINARY_TYPE) {
return(len); return static_cast<unsigned>(len);
} else { } else {
if (mbminlen == mbmaxlen) { if (mbminlen == mbmaxlen) {
return(len); return static_cast<unsigned>(len);
} }
/* this is a variable-length character set */ /* this is a variable-length character set */
ut_a(mbminlen > 0); ut_a(mbminlen > 0);
ut_a(mbmaxlen > mbminlen); ut_a(mbmaxlen > mbminlen);
ut_a(len % mbmaxlen == 0); ut_a(len % mbmaxlen == 0);
return(len * mbminlen / mbmaxlen); return static_cast<unsigned>(
len * mbminlen / mbmaxlen);
} }
case DATA_VARCHAR: case DATA_VARCHAR:
case DATA_BINARY: case DATA_BINARY:

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -272,7 +272,7 @@ struct ind_node_t{
/*----------------------*/ /*----------------------*/
/* Local storage for this graph node */ /* Local storage for this graph node */
ulint state; /*!< node execution state */ ulint state; /*!< node execution state */
ulint page_no; /* root page number of the index */ uint32_t page_no; /* root page number of the index */
dict_table_t* table; /*!< table which owns the index */ dict_table_t* table; /*!< table which owns the index */
dtuple_t* ind_row; /* index definition row built */ dtuple_t* ind_row; /* index definition row built */
ulint field_no; /* next field definition to insert */ ulint field_no; /* next field definition to insert */

View File

@ -189,7 +189,7 @@ dict_table_close_and_drop(
Gets the minimum number of bytes per character. Gets the minimum number of bytes per character.
@return minimum multi-byte char size, in bytes */ @return minimum multi-byte char size, in bytes */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_mbminlen( dict_col_get_mbminlen(
/*==================*/ /*==================*/
const dict_col_t* col) /*!< in: column */ const dict_col_t* col) /*!< in: column */
@ -198,7 +198,7 @@ dict_col_get_mbminlen(
Gets the maximum number of bytes per character. Gets the maximum number of bytes per character.
@return maximum multi-byte char size, in bytes */ @return maximum multi-byte char size, in bytes */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_mbmaxlen( dict_col_get_mbmaxlen(
/*==================*/ /*==================*/
const dict_col_t* col) /*!< in: column */ const dict_col_t* col) /*!< in: column */
@ -254,7 +254,7 @@ dict_col_type_assert_equal(
Returns the minimum size of the column. Returns the minimum size of the column.
@return minimum size */ @return minimum size */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_min_size( dict_col_get_min_size(
/*==================*/ /*==================*/
const dict_col_t* col) /*!< in: column */ const dict_col_t* col) /*!< in: column */
@ -272,7 +272,7 @@ dict_col_get_max_size(
Returns the size of a fixed size column, 0 if not a fixed size column. Returns the size of a fixed size column, 0 if not a fixed size column.
@return fixed size, or 0 */ @return fixed size, or 0 */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_fixed_size( dict_col_get_fixed_size(
/*====================*/ /*====================*/
const dict_col_t* col, /*!< in: column */ const dict_col_t* col, /*!< in: column */
@ -283,7 +283,7 @@ Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column.
For fixed length types it is the fixed length of the type, otherwise 0. For fixed length types it is the fixed length of the type, otherwise 0.
@return SQL null storage size in ROW_FORMAT=REDUNDANT */ @return SQL null storage size in ROW_FORMAT=REDUNDANT */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_sql_null_size( dict_col_get_sql_null_size(
/*=======================*/ /*=======================*/
const dict_col_t* col, /*!< in: column */ const dict_col_t* col, /*!< in: column */
@ -293,7 +293,7 @@ dict_col_get_sql_null_size(
Gets the column number. Gets the column number.
@return col->ind, table column position (starting from 0) */ @return col->ind, table column position (starting from 0) */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_no( dict_col_get_no(
/*============*/ /*============*/
const dict_col_t* col) /*!< in: column */ const dict_col_t* col) /*!< in: column */
@ -700,7 +700,7 @@ dictionary cache.
@return number of user-defined (e.g., not ROW_ID) non-virtual @return number of user-defined (e.g., not ROW_ID) non-virtual
columns of a table */ columns of a table */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_table_get_n_user_cols( dict_table_get_n_user_cols(
/*=======================*/ /*=======================*/
const dict_table_t* table) /*!< in: table */ const dict_table_t* table) /*!< in: table */
@ -710,7 +710,7 @@ Gets the number of all non-virtual columns (also system) in a table
in the dictionary cache. in the dictionary cache.
@return number of columns of a table */ @return number of columns of a table */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_table_get_n_cols( dict_table_get_n_cols(
/*==================*/ /*==================*/
const dict_table_t* table) /*!< in: table */ const dict_table_t* table) /*!< in: table */
@ -720,7 +720,7 @@ dict_table_get_n_cols(
@param[in] table the table to check @param[in] table the table to check
@return number of virtual columns of a table */ @return number of virtual columns of a table */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_table_get_n_v_cols( dict_table_get_n_v_cols(
const dict_table_t* table); const dict_table_t* table);
@ -799,7 +799,7 @@ dict_col_t*
dict_table_get_sys_col( dict_table_get_sys_col(
/*===================*/ /*===================*/
const dict_table_t* table, /*!< in: table */ const dict_table_t* table, /*!< in: table */
ulint sys) /*!< in: DATA_ROW_ID, ... */ unsigned sys) /*!< in: DATA_ROW_ID, ... */
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
#else /* UNIV_DEBUG */ #else /* UNIV_DEBUG */
#define dict_table_get_nth_col(table, pos) (&(table)->cols[pos]) #define dict_table_get_nth_col(table, pos) (&(table)->cols[pos])
@ -824,18 +824,18 @@ dict_table_get_col_name(const dict_table_t* table, ulint col_nr)
Gets the given system column number of a table. Gets the given system column number of a table.
@return column number */ @return column number */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_table_get_sys_col_no( dict_table_get_sys_col_no(
/*======================*/ /*======================*/
const dict_table_t* table, /*!< in: table */ const dict_table_t* table, /*!< in: table */
ulint sys) /*!< in: DATA_ROW_ID, ... */ unsigned sys) /*!< in: DATA_ROW_ID, ... */
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
/********************************************************************//** /********************************************************************//**
Returns the minimum data size of an index record. Returns the minimum data size of an index record.
@return minimum data size in bytes */ @return minimum data size in bytes */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_min_size( dict_index_get_min_size(
/*====================*/ /*====================*/
const dict_index_t* index) /*!< in: index */ const dict_index_t* index) /*!< in: index */
@ -1006,7 +1006,7 @@ Gets the number of fields in the internal representation of an index,
including fields added by the dictionary system. including fields added by the dictionary system.
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_fields( dict_index_get_n_fields(
/*====================*/ /*====================*/
const dict_index_t* index) /*!< in: an internal const dict_index_t* index) /*!< in: an internal
@ -1021,7 +1021,7 @@ we do not take multiversioning into account: in the B-tree use the value
returned by dict_index_get_n_unique_in_tree. returned by dict_index_get_n_unique_in_tree.
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_unique( dict_index_get_n_unique(
/*====================*/ /*====================*/
const dict_index_t* index) /*!< in: an internal representation const dict_index_t* index) /*!< in: an internal representation
@ -1033,7 +1033,7 @@ which uniquely determine the position of an index entry in the index, if
we also take multiversioning into account. we also take multiversioning into account.
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_unique_in_tree( dict_index_get_n_unique_in_tree(
/*============================*/ /*============================*/
const dict_index_t* index) /*!< in: an internal representation const dict_index_t* index) /*!< in: an internal representation
@ -1051,7 +1051,7 @@ include page no field.
@param[in] index index @param[in] index index
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_unique_in_tree_nonleaf( dict_index_get_n_unique_in_tree_nonleaf(
const dict_index_t* index) const dict_index_t* index)
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
@ -1062,7 +1062,7 @@ unique, but this function returns the number of fields the user defined
in the index as ordering fields. in the index as ordering fields.
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_ordering_defined_by_user( dict_index_get_n_ordering_defined_by_user(
/*======================================*/ /*======================================*/
const dict_index_t* index) /*!< in: an internal representation const dict_index_t* index) /*!< in: an internal representation
@ -1150,7 +1150,7 @@ dict_index_get_nth_field_pos(
/********************************************************************//** /********************************************************************//**
Looks for column n position in the clustered index. Looks for column n position in the clustered index.
@return position in internal representation of the clustered index */ @return position in internal representation of the clustered index */
ulint unsigned
dict_table_get_nth_col_pos( dict_table_get_nth_col_pos(
/*=======================*/ /*=======================*/
const dict_table_t* table, /*!< in: table */ const dict_table_t* table, /*!< in: table */
@ -1274,7 +1274,7 @@ dict_index_build_data_tuple(
Gets the page number of the root of the index tree. Gets the page number of the root of the index tree.
@return page number */ @return page number */
UNIV_INLINE UNIV_INLINE
ulint uint32_t
dict_index_get_page( dict_index_get_page(
/*================*/ /*================*/
const dict_index_t* tree) /*!< in: index */ const dict_index_t* tree) /*!< in: index */

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2019, MariaDB Corporation. Copyright (c) 2013, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -31,7 +31,7 @@ Created 1/8/1996 Heikki Tuuri
Gets the minimum number of bytes per character. Gets the minimum number of bytes per character.
@return minimum multi-byte char size, in bytes */ @return minimum multi-byte char size, in bytes */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_mbminlen( dict_col_get_mbminlen(
/*==================*/ /*==================*/
const dict_col_t* col) /*!< in: column */ const dict_col_t* col) /*!< in: column */
@ -42,7 +42,7 @@ dict_col_get_mbminlen(
Gets the maximum number of bytes per character. Gets the maximum number of bytes per character.
@return maximum multi-byte char size, in bytes */ @return maximum multi-byte char size, in bytes */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_mbmaxlen( dict_col_get_mbmaxlen(
/*==================*/ /*==================*/
const dict_col_t* col) /*!< in: column */ const dict_col_t* col) /*!< in: column */
@ -93,7 +93,7 @@ dict_col_type_assert_equal(
Returns the minimum size of the column. Returns the minimum size of the column.
@return minimum size */ @return minimum size */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_min_size( dict_col_get_min_size(
/*==================*/ /*==================*/
const dict_col_t* col) /*!< in: column */ const dict_col_t* col) /*!< in: column */
@ -116,7 +116,7 @@ dict_col_get_max_size(
Returns the size of a fixed size column, 0 if not a fixed size column. Returns the size of a fixed size column, 0 if not a fixed size column.
@return fixed size, or 0 */ @return fixed size, or 0 */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_fixed_size( dict_col_get_fixed_size(
/*====================*/ /*====================*/
const dict_col_t* col, /*!< in: column */ const dict_col_t* col, /*!< in: column */
@ -130,7 +130,7 @@ Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column.
For fixed length types it is the fixed length of the type, otherwise 0. For fixed length types it is the fixed length of the type, otherwise 0.
@return SQL null storage size in ROW_FORMAT=REDUNDANT */ @return SQL null storage size in ROW_FORMAT=REDUNDANT */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_sql_null_size( dict_col_get_sql_null_size(
/*=======================*/ /*=======================*/
const dict_col_t* col, /*!< in: column */ const dict_col_t* col, /*!< in: column */
@ -143,7 +143,7 @@ dict_col_get_sql_null_size(
Gets the column number. Gets the column number.
@return col->ind, table column position (starting from 0) */ @return col->ind, table column position (starting from 0) */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_col_get_no( dict_col_get_no(
/*============*/ /*============*/
const dict_col_t* col) /*!< in: column */ const dict_col_t* col) /*!< in: column */
@ -247,7 +247,7 @@ dictionary cache.
@return number of user-defined (e.g., not ROW_ID) non-virtual @return number of user-defined (e.g., not ROW_ID) non-virtual
columns of a table */ columns of a table */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_table_get_n_user_cols( dict_table_get_n_user_cols(
/*=======================*/ /*=======================*/
const dict_table_t* table) /*!< in: table */ const dict_table_t* table) /*!< in: table */
@ -264,7 +264,7 @@ Gets the number of all non-virtual columns (also system) in a table
in the dictionary cache. in the dictionary cache.
@return number of non-virtual columns of a table */ @return number of non-virtual columns of a table */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_table_get_n_cols( dict_table_get_n_cols(
/*==================*/ /*==================*/
const dict_table_t* table) /*!< in: table */ const dict_table_t* table) /*!< in: table */
@ -277,7 +277,7 @@ dict_table_get_n_cols(
@param[in] table the table to check @param[in] table the table to check
@return number of virtual columns of a table */ @return number of virtual columns of a table */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_table_get_n_v_cols( dict_table_get_n_v_cols(
const dict_table_t* table) const dict_table_t* table)
{ {
@ -296,7 +296,7 @@ dict_table_has_indexed_v_cols(
const dict_table_t* table) const dict_table_t* table)
{ {
for (ulint i = 0; i < table->n_v_cols; i++) { for (unsigned i = 0; i < table->n_v_cols; i++) {
const dict_v_col_t* col = dict_table_get_nth_v_col(table, i); const dict_v_col_t* col = dict_table_get_nth_v_col(table, i);
if (col->m_col.ord_part) { if (col->m_col.ord_part) {
return(true); return(true);
@ -399,7 +399,7 @@ dict_col_t*
dict_table_get_sys_col( dict_table_get_sys_col(
/*===================*/ /*===================*/
const dict_table_t* table, /*!< in: table */ const dict_table_t* table, /*!< in: table */
ulint sys) /*!< in: DATA_ROW_ID, ... */ unsigned sys) /*!< in: DATA_ROW_ID, ... */
{ {
dict_col_t* col; dict_col_t* col;
col = dict_table_get_nth_col(table, col = dict_table_get_nth_col(table,
@ -415,11 +415,11 @@ dict_table_get_sys_col(
Gets the given system column number of a table. Gets the given system column number of a table.
@return column number */ @return column number */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_table_get_sys_col_no( dict_table_get_sys_col_no(
/*======================*/ /*======================*/
const dict_table_t* table, /*!< in: table */ const dict_table_t* table, /*!< in: table */
ulint sys) /*!< in: DATA_ROW_ID, ... */ unsigned sys) /*!< in: DATA_ROW_ID, ... */
{ {
ut_ad(sys < DATA_N_SYS_COLS); ut_ad(sys < DATA_N_SYS_COLS);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
@ -710,7 +710,7 @@ Gets the number of fields in the internal representation of an index,
including fields added by the dictionary system. including fields added by the dictionary system.
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_fields( dict_index_get_n_fields(
/*====================*/ /*====================*/
const dict_index_t* index) /*!< in: an internal const dict_index_t* index) /*!< in: an internal
@ -728,7 +728,7 @@ we do not take multiversioning into account: in the B-tree use the value
returned by dict_index_get_n_unique_in_tree. returned by dict_index_get_n_unique_in_tree.
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_unique( dict_index_get_n_unique(
/*====================*/ /*====================*/
const dict_index_t* index) /*!< in: an internal representation const dict_index_t* index) /*!< in: an internal representation
@ -745,7 +745,7 @@ which uniquely determine the position of an index entry in the index, if
we also take multiversioning into account. we also take multiversioning into account.
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_unique_in_tree( dict_index_get_n_unique_in_tree(
/*============================*/ /*============================*/
const dict_index_t* index) /*!< in: an internal representation const dict_index_t* index) /*!< in: an internal representation
@ -770,7 +770,7 @@ include page no field.
@param[in] index index @param[in] index index
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_unique_in_tree_nonleaf( dict_index_get_n_unique_in_tree_nonleaf(
const dict_index_t* index) const dict_index_t* index)
{ {
@ -794,7 +794,7 @@ to make a clustered index unique, but this function returns the number of
fields the user defined in the index as ordering fields. fields the user defined in the index as ordering fields.
@return number of fields */ @return number of fields */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_n_ordering_defined_by_user( dict_index_get_n_ordering_defined_by_user(
/*======================================*/ /*======================================*/
const dict_index_t* index) /*!< in: an internal representation const dict_index_t* index) /*!< in: an internal representation
@ -879,27 +879,25 @@ dict_index_get_nth_col_pos(
Returns the minimum data size of an index record. Returns the minimum data size of an index record.
@return minimum data size in bytes */ @return minimum data size in bytes */
UNIV_INLINE UNIV_INLINE
ulint unsigned
dict_index_get_min_size( dict_index_get_min_size(
/*====================*/ /*====================*/
const dict_index_t* index) /*!< in: index */ const dict_index_t* index) /*!< in: index */
{ {
ulint n = dict_index_get_n_fields(index); unsigned n= dict_index_get_n_fields(index);
ulint size = 0; unsigned size= 0;
while (n--) { while (n--)
size += dict_col_get_min_size(dict_index_get_nth_col(index, size+= dict_col_get_min_size(dict_index_get_nth_col(index, n));
n));
}
return(size); return size;
} }
/*********************************************************************//** /*********************************************************************//**
Gets the page number of the root of the index tree. Gets the page number of the root of the index tree.
@return page number */ @return page number */
UNIV_INLINE UNIV_INLINE
ulint uint32_t
dict_index_get_page( dict_index_get_page(
/*================*/ /*================*/
const dict_index_t* index) /*!< in: index */ const dict_index_t* index) /*!< in: index */

View File

@ -2,7 +2,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2019, MariaDB Corporation. Copyright (c) 2013, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -950,6 +950,9 @@ const char innobase_index_reserve_name[] = "GEN_CLUST_INDEX";
/** Data structure for an index. Most fields will be /** Data structure for an index. Most fields will be
initialized to 0, NULL or FALSE in dict_mem_index_create(). */ initialized to 0, NULL or FALSE in dict_mem_index_create(). */
struct dict_index_t { struct dict_index_t {
/** Maximum number of fields */
static constexpr unsigned MAX_N_FIELDS= (1U << 10) - 1;
index_id_t id; /*!< id of the index */ index_id_t id; /*!< id of the index */
mem_heap_t* heap; /*!< memory heap */ mem_heap_t* heap; /*!< memory heap */
id_name_t name; /*!< index name */ id_name_t name; /*!< index name */
@ -2352,7 +2355,8 @@ inline void dict_index_t::clear_instant_alter()
} }
DBUG_ASSERT(&fields[n_fields - table->n_dropped()] == end); DBUG_ASSERT(&fields[n_fields - table->n_dropped()] == end);
n_core_fields = n_fields = n_def = end - fields; n_core_fields = n_fields = n_def
= static_cast<unsigned>(end - fields) & MAX_N_FIELDS;
n_core_null_bytes = UT_BITS_IN_BYTES(n_nullable); n_core_null_bytes = UT_BITS_IN_BYTES(n_nullable);
std::sort(begin, end, [](const dict_field_t& a, const dict_field_t& b) std::sort(begin, end, [](const dict_field_t& a, const dict_field_t& b)
{ return a.col->ind < b.col->ind; }); { return a.col->ind < b.col->ind; });
@ -2361,7 +2365,10 @@ inline void dict_index_t::clear_instant_alter()
auto a = std::find_if(begin, end, auto a = std::find_if(begin, end,
[ai_col](const dict_field_t& f) [ai_col](const dict_field_t& f)
{ return f.col == ai_col; }); { return f.col == ai_col; });
table->persistent_autoinc = (a == end) ? 0 : 1 + (a - fields); table->persistent_autoinc = (a == end)
? 0
: (1 + static_cast<unsigned>(a - fields))
& MAX_N_FIELDS;
} }
} }

View File

@ -388,10 +388,7 @@ fil_crypt_set_rotation_iops(
/********************************************************************* /*********************************************************************
Adjust encrypt tables Adjust encrypt tables
@param[in] val New setting for innodb-encrypt-tables */ @param[in] val New setting for innodb-encrypt-tables */
UNIV_INTERN void fil_crypt_set_encrypt_tables(ulong val);
void
fil_crypt_set_encrypt_tables(
uint val);
/********************************************************************* /*********************************************************************
Init threads for key rotation */ Init threads for key rotation */

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -36,6 +36,7 @@ simple headers.
/* Forward declarations */ /* Forward declarations */
class THD; class THD;
class Field;
// JAN: TODO missing features: // JAN: TODO missing features:
#undef MYSQL_FT_INIT_EXT #undef MYSQL_FT_INIT_EXT
@ -164,10 +165,8 @@ VARCHAR and the new true VARCHAR in >= 5.0.3 by the 'prtype'.
at least ENUM and SET, and unsigned integer types are 'unsigned types' at least ENUM and SET, and unsigned integer types are 'unsigned types'
@param[in] f MySQL Field @param[in] f MySQL Field
@return DATA_BINARY, DATA_VARCHAR, ... */ @return DATA_BINARY, DATA_VARCHAR, ... */
ulint unsigned
get_innobase_type_from_mysql_type( get_innobase_type_from_mysql_type(unsigned *unsigned_flag, const Field *field);
ulint* unsigned_flag,
const void* field);
/******************************************************************//** /******************************************************************//**
Get the variable length bounds of the given character set. */ Get the variable length bounds of the given character set. */
@ -175,8 +174,8 @@ void
innobase_get_cset_width( innobase_get_cset_width(
/*====================*/ /*====================*/
ulint cset, /*!< in: MySQL charset-collation code */ ulint cset, /*!< in: MySQL charset-collation code */
ulint* mbminlen, /*!< out: minimum length of a char (in bytes) */ unsigned*mbminlen, /*!< out: minimum length of a char (in bytes) */
ulint* mbmaxlen); /*!< out: maximum length of a char (in bytes) */ unsigned*mbmaxlen); /*!< out: maximum length of a char (in bytes) */
/******************************************************************//** /******************************************************************//**
Compares NUL-terminated UTF-8 strings case insensitively. Compares NUL-terminated UTF-8 strings case insensitively.
@ -230,14 +229,11 @@ innobase_casedn_str(
char* a); /*!< in/out: string to put in lower case */ char* a); /*!< in/out: string to put in lower case */
#ifdef WITH_WSREP #ifdef WITH_WSREP
UNIV_INTERN
int int
wsrep_innobase_kill_one_trx(void * const thd_ptr, wsrep_innobase_kill_one_trx(THD *bf_thd, const trx_t *bf_trx,
const trx_t * const bf_trx, trx_t *victim_trx, bool signal);
trx_t *victim_trx,
ibool signal);
ulint wsrep_innobase_mysql_sort(int mysql_type, uint charset_number, ulint wsrep_innobase_mysql_sort(int mysql_type, uint charset_number,
unsigned char* str, unsigned int str_length, unsigned char* str, ulint str_length,
unsigned int buf_length); unsigned int buf_length);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -344,7 +344,7 @@ lock_sec_rec_read_check_and_lock(
records: LOCK_S or LOCK_X; the records: LOCK_S or LOCK_X; the
latter is possible in latter is possible in
SELECT FOR UPDATE */ SELECT FOR UPDATE */
ulint gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP */ LOCK_REC_NOT_GAP */
que_thr_t* thr); /*!< in: query thread */ que_thr_t* thr); /*!< in: query thread */
/*********************************************************************//** /*********************************************************************//**
@ -372,7 +372,7 @@ lock_clust_rec_read_check_and_lock(
records: LOCK_S or LOCK_X; the records: LOCK_S or LOCK_X; the
latter is possible in latter is possible in
SELECT FOR UPDATE */ SELECT FOR UPDATE */
ulint gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP */ LOCK_REC_NOT_GAP */
que_thr_t* thr); /*!< in: query thread */ que_thr_t* thr); /*!< in: query thread */
/*********************************************************************//** /*********************************************************************//**
@ -401,7 +401,7 @@ lock_clust_rec_read_check_and_lock_alt(
records: LOCK_S or LOCK_X; the records: LOCK_S or LOCK_X; the
latter is possible in latter is possible in
SELECT FOR UPDATE */ SELECT FOR UPDATE */
ulint gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP */ LOCK_REC_NOT_GAP */
que_thr_t* thr) /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
@ -443,7 +443,7 @@ be granted immediately, the query thread is put to wait.
dberr_t dberr_t
lock_table( lock_table(
/*=======*/ /*=======*/
ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG bit is set, unsigned flags, /*!< in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing */ does nothing */
dict_table_t* table, /*!< in/out: database table dict_table_t* table, /*!< in/out: database table
in dictionary cache */ in dictionary cache */
@ -832,7 +832,7 @@ lock_rec_create(
lock_t* c_lock, /*!< conflicting lock */ lock_t* c_lock, /*!< conflicting lock */
que_thr_t* thr, /*!< thread owning trx */ que_thr_t* thr, /*!< thread owning trx */
#endif #endif
ulint type_mode,/*!< in: lock mode and wait unsigned type_mode,/*!< in: lock mode and wait
flag, type is ignored and flag, type is ignored and
replaced by LOCK_REC */ replaced by LOCK_REC */
const buf_block_t* block, /*!< in: buffer block containing const buf_block_t* block, /*!< in: buffer block containing
@ -871,7 +871,7 @@ lock_rec_create_low(
lock_t* c_lock, /*!< conflicting lock */ lock_t* c_lock, /*!< conflicting lock */
que_thr_t* thr, /*!< thread owning trx */ que_thr_t* thr, /*!< thread owning trx */
#endif #endif
ulint type_mode, unsigned type_mode,
ulint space, ulint space,
ulint page_no, ulint page_no,
const page_t* page, const page_t* page,
@ -902,7 +902,7 @@ lock_rec_enqueue_waiting(
#ifdef WITH_WSREP #ifdef WITH_WSREP
lock_t* c_lock, /*!< conflicting lock */ lock_t* c_lock, /*!< conflicting lock */
#endif #endif
ulint type_mode, unsigned type_mode,
const buf_block_t* block, const buf_block_t* block,
ulint heap_no, ulint heap_no,
dict_index_t* index, dict_index_t* index,

View File

@ -110,7 +110,7 @@ lock_rec_create(
lock_t* c_lock, /*!< conflicting lock */ lock_t* c_lock, /*!< conflicting lock */
que_thr_t* thr, /*!< thread owning trx */ que_thr_t* thr, /*!< thread owning trx */
#endif #endif
ulint type_mode,/*!< in: lock mode and wait unsigned type_mode,/*!< in: lock mode and wait
flag, type is ignored and flag, type is ignored and
replaced by LOCK_REC */ replaced by LOCK_REC */
const buf_block_t* block, /*!< in: buffer block containing const buf_block_t* block, /*!< in: buffer block containing

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, MariaDB Corporation. Copyright (c) 2018, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -48,7 +48,7 @@ lock_prdt_lock(
records: LOCK_S or LOCK_X; the records: LOCK_S or LOCK_X; the
latter is possible in latter is possible in
SELECT FOR UPDATE */ SELECT FOR UPDATE */
ulint type_mode, unsigned type_mode,
/*!< in: LOCK_PREDICATE or LOCK_PRDT_PAGE */ /*!< in: LOCK_PREDICATE or LOCK_PRDT_PAGE */
que_thr_t* thr); /*!< in: query thread que_thr_t* thr); /*!< in: query thread
(can be NULL if BTR_NO_LOCKING_FLAG) */ (can be NULL if BTR_NO_LOCKING_FLAG) */
@ -90,7 +90,7 @@ bool
lock_prdt_has_to_wait( lock_prdt_has_to_wait(
/*==================*/ /*==================*/
const trx_t* trx, /*!< in: trx of new lock */ const trx_t* trx, /*!< in: trx of new lock */
ulint type_mode,/*!< in: precise mode of the new lock unsigned type_mode,/*!< in: precise mode of the new lock
to set: LOCK_S or LOCK_X, possibly to set: LOCK_S or LOCK_X, possibly
ORed to LOCK_PREDICATE or LOCK_PRDT_PAGE, ORed to LOCK_PREDICATE or LOCK_PRDT_PAGE,
LOCK_INSERT_INTENTION */ LOCK_INSERT_INTENTION */
@ -158,7 +158,7 @@ bool
lock_prdt_has_to_wait( lock_prdt_has_to_wait(
/*==================*/ /*==================*/
const trx_t* trx, /*!< in: trx of new lock */ const trx_t* trx, /*!< in: trx of new lock */
ulint type_mode,/*!< in: precise mode of the new lock unsigned type_mode,/*!< in: precise mode of the new lock
to set: LOCK_S or LOCK_X, possibly to set: LOCK_S or LOCK_X, possibly
ORed to LOCK_PREDICATE or LOCK_PRDT_PAGE, ORed to LOCK_PREDICATE or LOCK_PRDT_PAGE,
LOCK_INSERT_INTENTION */ LOCK_INSERT_INTENTION */

View File

@ -712,7 +712,7 @@ page_get_instant(const page_t* page)
ut_ad(i <= PAGE_NO_DIRECTION); ut_ad(i <= PAGE_NO_DIRECTION);
break; break;
default: default:
ut_ad(!"invalid page type"); ut_ad("invalid page type" == 0);
break; break;
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */

View File

@ -685,8 +685,8 @@ struct row_prebuilt_t {
updated */ updated */
dtuple_t* clust_ref; /*!< prebuilt dtuple used in dtuple_t* clust_ref; /*!< prebuilt dtuple used in
sel/upd/del */ sel/upd/del */
ulint select_lock_type;/*!< LOCK_NONE, LOCK_S, or LOCK_X */ lock_mode select_lock_type;/*!< LOCK_NONE, LOCK_S, or LOCK_X */
ulint stored_select_lock_type;/*!< this field is used to lock_mode stored_select_lock_type;/*!< this field is used to
remember the original select_lock_type remember the original select_lock_type
that was decided in ha_innodb.cc, that was decided in ha_innodb.cc,
::store_lock(), ::external_lock(), ::store_lock(), ::external_lock(),

View File

@ -342,7 +342,7 @@ struct sel_node_t{
ibool set_x_locks; /*!< TRUE if the cursor is for update or ibool set_x_locks; /*!< TRUE if the cursor is for update or
delete, which means that a row x-lock delete, which means that a row x-lock
should be placed on the cursor row */ should be placed on the cursor row */
ulint row_lock_mode; /*!< LOCK_X or LOCK_S */ lock_mode row_lock_mode; /*!< LOCK_X or LOCK_S */
ulint n_tables; /*!< number of tables */ ulint n_tables; /*!< number of tables */
ulint fetch_table; /*!< number of the next table to access ulint fetch_table; /*!< number of the next table to access
in the join */ in the join */

View File

@ -401,10 +401,6 @@ The real value is set based on the value of io_capacity. */
#define SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT (~0UL) #define SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT (~0UL)
#define SRV_MAX_IO_CAPACITY_LIMIT (~0UL) #define SRV_MAX_IO_CAPACITY_LIMIT (~0UL)
extern ulong srv_max_io_capacity; extern ulong srv_max_io_capacity;
/* Returns the number of IO operations that is X percent of the
capacity. PCT_IO(5) -> returns the number of IO operations that
is 5% of the max where max is srv_io_capacity. */
#define PCT_IO(p) ((ulong) (srv_io_capacity * ((double) (p) / 100.0)))
/* The "innodb_stats_method" setting, decides how InnoDB is going /* The "innodb_stats_method" setting, decides how InnoDB is going
to treat NULL value when collecting statistics. It is not defined to treat NULL value when collecting statistics. It is not defined
@ -518,8 +514,8 @@ i/o handler thread */
extern const char* srv_io_thread_op_info[]; extern const char* srv_io_thread_op_info[];
extern const char* srv_io_thread_function[]; extern const char* srv_io_thread_function[];
/* the number of purge threads to use from the worker pool (currently 0 or 1) */ /** innodb_purge_threads; the number of purge tasks to use */
extern ulong srv_n_purge_threads; extern uint srv_n_purge_threads;
/* the number of pages to purge in one batch */ /* the number of pages to purge in one batch */
extern ulong srv_purge_batch_size; extern ulong srv_purge_batch_size;
@ -552,8 +548,6 @@ extern ulong srv_fatal_semaphore_wait_threshold;
/** Buffer pool dump status frequence in percentages */ /** Buffer pool dump status frequence in percentages */
extern ulong srv_buf_dump_status_frequency; extern ulong srv_buf_dump_status_frequency;
#define srv_max_purge_threads 32
# ifdef UNIV_PFS_THREAD # ifdef UNIV_PFS_THREAD
extern mysql_pfs_key_t page_cleaner_thread_key; extern mysql_pfs_key_t page_cleaner_thread_key;
extern mysql_pfs_key_t recv_writer_thread_key; extern mysql_pfs_key_t recv_writer_thread_key;

View File

@ -247,12 +247,8 @@ trx_undo_prev_version_build(
@param[in,out] orig_len original length of the locally stored part @param[in,out] orig_len original length of the locally stored part
of an externally stored column, or 0 of an externally stored column, or 0
@return remaining part of undo log record after reading these values */ @return remaining part of undo log record after reading these values */
byte* byte *trx_undo_rec_get_col_val(const byte *ptr, const byte **field,
trx_undo_rec_get_col_val( uint32_t *len, uint32_t *orig_len);
const byte* ptr,
const byte** field,
ulint* len,
ulint* orig_len);
/** Read virtual column value from undo log /** Read virtual column value from undo log
@param[in] table the table @param[in] table the table
@ -275,7 +271,7 @@ info, and verify the column is still indexed, and output its position
@param[in,out] is_undo_log his function is used to parse both undo log, @param[in,out] is_undo_log his function is used to parse both undo log,
and online log for virtual columns. So and online log for virtual columns. So
check to see if this is undo log check to see if this is undo log
@param[out] field_no the column number @param[out] field_no the column number, or FIL_NULL if not indexed
@return remaining part of undo log record after reading these values */ @return remaining part of undo log record after reading these values */
const byte* const byte*
trx_undo_read_v_idx( trx_undo_read_v_idx(
@ -283,7 +279,7 @@ trx_undo_read_v_idx(
const byte* ptr, const byte* ptr,
bool first_v_col, bool first_v_col,
bool* is_undo_log, bool* is_undo_log,
ulint* field_no); uint32_t* field_no);
/* Types of an undo log record: these have to be smaller than 16, as the /* Types of an undo log record: these have to be smaller than 16, as the
compilation info multiplied by 16 is ORed to this value in an undo log compilation info multiplied by 16 is ORed to this value in an undo log

View File

@ -280,13 +280,15 @@ ut_stage_alter_t::inc(ulint inc_val)
(double) N records per page, then the work_completed (double) N records per page, then the work_completed
should be incremented on the inc() calls round(k*N), should be incremented on the inc() calls round(k*N),
for k=1,2,3... */ for k=1,2,3... */
const double every_nth = m_n_recs_per_page * multi_factor; const double every_nth = m_n_recs_per_page *
static_cast<double>(multi_factor);
const ulint k = static_cast<ulint>( const ulint k = static_cast<ulint>(
round(m_n_recs_processed / every_nth)); round(static_cast<double>(m_n_recs_processed) /
every_nth));
const ulint nth = static_cast<ulint>( const ulint nth = static_cast<ulint>(
round(k * every_nth)); round(static_cast<double>(k) * every_nth));
should_proceed = m_n_recs_processed == nth; should_proceed = m_n_recs_processed == nth;
@ -328,7 +330,8 @@ ut_stage_alter_t::end_phase_read_pk()
m_n_recs_per_page = 1.0; m_n_recs_per_page = 1.0;
} else { } else {
m_n_recs_per_page = std::max( m_n_recs_per_page = std::max(
static_cast<double>(m_n_pk_recs) / m_n_pk_pages, static_cast<double>(m_n_pk_recs)
/ static_cast<double>(m_n_pk_pages),
1.0); 1.0);
} }
} }

View File

@ -632,7 +632,7 @@ lock_rec_has_to_wait(
bool for_locking, bool for_locking,
/*!< in is called locking or releasing */ /*!< in is called locking or releasing */
const trx_t* trx, /*!< in: trx of new lock */ const trx_t* trx, /*!< in: trx of new lock */
ulint type_mode,/*!< in: precise mode of the new lock unsigned type_mode,/*!< in: precise mode of the new lock
to set: LOCK_S or LOCK_X, possibly to set: LOCK_S or LOCK_X, possibly
ORed to LOCK_GAP or LOCK_REC_NOT_GAP, ORed to LOCK_GAP or LOCK_REC_NOT_GAP,
LOCK_INSERT_INTENTION */ LOCK_INSERT_INTENTION */
@ -1136,7 +1136,7 @@ static
lock_t* lock_t*
lock_rec_other_has_conflicting( lock_rec_other_has_conflicting(
/*===========================*/ /*===========================*/
ulint mode, /*!< in: LOCK_S or LOCK_X, unsigned mode, /*!< in: LOCK_S or LOCK_X,
possibly ORed to LOCK_GAP or possibly ORed to LOCK_GAP or
LOC_REC_NOT_GAP, LOC_REC_NOT_GAP,
LOCK_INSERT_INTENTION */ LOCK_INSERT_INTENTION */
@ -1313,7 +1313,7 @@ lock_rec_create_low(
lock_t* c_lock, /*!< conflicting lock */ lock_t* c_lock, /*!< conflicting lock */
que_thr_t* thr, /*!< thread owning trx */ que_thr_t* thr, /*!< thread owning trx */
#endif #endif
ulint type_mode, unsigned type_mode,
ulint space, ulint space,
ulint page_no, ulint page_no,
const page_t* page, const page_t* page,
@ -1662,7 +1662,7 @@ lock_rec_enqueue_waiting(
#ifdef WITH_WSREP #ifdef WITH_WSREP
lock_t* c_lock, /*!< conflicting lock */ lock_t* c_lock, /*!< conflicting lock */
#endif #endif
ulint type_mode, unsigned type_mode,
const buf_block_t* block, const buf_block_t* block,
ulint heap_no, ulint heap_no,
dict_index_t* index, dict_index_t* index,
@ -1770,7 +1770,7 @@ static
void void
lock_rec_add_to_queue( lock_rec_add_to_queue(
/*==================*/ /*==================*/
ulint type_mode,/*!< in: lock mode, wait, gap unsigned type_mode,/*!< in: lock mode, wait, gap
etc. flags; type is ignored etc. flags; type is ignored
and replaced by LOCK_REC */ and replaced by LOCK_REC */
const buf_block_t* block, /*!< in: buffer block containing const buf_block_t* block, /*!< in: buffer block containing
@ -1902,7 +1902,7 @@ lock_rec_lock(
if no wait is necessary: we if no wait is necessary: we
assume that the caller will assume that the caller will
set an implicit lock */ set an implicit lock */
ulint mode, /*!< in: lock mode: LOCK_X or unsigned mode, /*!< in: lock mode: LOCK_X or
LOCK_S possibly ORed to either LOCK_S possibly ORed to either
LOCK_GAP or LOCK_REC_NOT_GAP */ LOCK_GAP or LOCK_REC_NOT_GAP */
const buf_block_t* block, /*!< in: buffer block containing const buf_block_t* block, /*!< in: buffer block containing
@ -2430,8 +2430,7 @@ lock_rec_inherit_to_gap(
|| lock_get_mode(lock) != || lock_get_mode(lock) !=
(lock->trx->duplicates ? LOCK_S : LOCK_X))) { (lock->trx->duplicates ? LOCK_S : LOCK_X))) {
lock_rec_add_to_queue( lock_rec_add_to_queue(
LOCK_REC | LOCK_GAP LOCK_REC | LOCK_GAP | lock_get_mode(lock),
| ulint(lock_get_mode(lock)),
heir_block, heir_heap_no, lock->index, heir_block, heir_heap_no, lock->index,
lock->trx, FALSE); lock->trx, FALSE);
} }
@ -2467,8 +2466,7 @@ lock_rec_inherit_to_gap_if_gap_lock(
|| !lock_rec_get_rec_not_gap(lock))) { || !lock_rec_get_rec_not_gap(lock))) {
lock_rec_add_to_queue( lock_rec_add_to_queue(
LOCK_REC | LOCK_GAP LOCK_REC | LOCK_GAP | lock_get_mode(lock),
| ulint(lock_get_mode(lock)),
block, heir_heap_no, lock->index, block, heir_heap_no, lock->index,
lock->trx, FALSE); lock->trx, FALSE);
} }
@ -2511,7 +2509,7 @@ lock_rec_move_low(
lock != NULL; lock != NULL;
lock = lock_rec_get_next(donator_heap_no, lock)) { lock = lock_rec_get_next(donator_heap_no, lock)) {
const ulint type_mode = lock->type_mode; const auto type_mode = lock->type_mode;
lock_rec_reset_nth_bit(lock, donator_heap_no); lock_rec_reset_nth_bit(lock, donator_heap_no);
@ -2744,7 +2742,7 @@ lock_move_rec_list_end(
lock = lock_rec_get_next_on_page(lock)) { lock = lock_rec_get_next_on_page(lock)) {
const rec_t* rec1 = rec; const rec_t* rec1 = rec;
const rec_t* rec2; const rec_t* rec2;
const ulint type_mode = lock->type_mode; const auto type_mode = lock->type_mode;
if (comp) { if (comp) {
if (page_offset(rec1) == PAGE_NEW_INFIMUM) { if (page_offset(rec1) == PAGE_NEW_INFIMUM) {
@ -2859,7 +2857,7 @@ lock_move_rec_list_start(
lock = lock_rec_get_next_on_page(lock)) { lock = lock_rec_get_next_on_page(lock)) {
const rec_t* rec1; const rec_t* rec1;
const rec_t* rec2; const rec_t* rec2;
const ulint type_mode = lock->type_mode; const auto type_mode = lock->type_mode;
if (comp) { if (comp) {
rec1 = page_rec_get_next_low( rec1 = page_rec_get_next_low(
@ -2972,7 +2970,7 @@ lock_rtr_move_rec_list(
ulint moved = 0; ulint moved = 0;
const rec_t* rec1; const rec_t* rec1;
const rec_t* rec2; const rec_t* rec2;
const ulint type_mode = lock->type_mode; const auto type_mode = lock->type_mode;
/* Copy lock requests on user records to new page and /* Copy lock requests on user records to new page and
reset the lock bits on the old */ reset the lock bits on the old */
@ -3453,7 +3451,7 @@ lock_table_create(
/*==============*/ /*==============*/
dict_table_t* table, /*!< in/out: database table dict_table_t* table, /*!< in/out: database table
in dictionary cache */ in dictionary cache */
ulint type_mode,/*!< in: lock mode possibly ORed with unsigned type_mode,/*!< in: lock mode possibly ORed with
LOCK_WAIT */ LOCK_WAIT */
trx_t* trx /*!< in: trx */ trx_t* trx /*!< in: trx */
#ifdef WITH_WSREP #ifdef WITH_WSREP
@ -3703,7 +3701,7 @@ static
dberr_t dberr_t
lock_table_enqueue_waiting( lock_table_enqueue_waiting(
/*=======================*/ /*=======================*/
ulint mode, /*!< in: lock mode this transaction is unsigned mode, /*!< in: lock mode this transaction is
requesting */ requesting */
dict_table_t* table, /*!< in/out: table */ dict_table_t* table, /*!< in/out: table */
que_thr_t* thr /*!< in: query thread */ que_thr_t* thr /*!< in: query thread */
@ -3740,7 +3738,7 @@ lock_table_enqueue_waiting(
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/* Enqueue the lock request that will wait to be granted */ /* Enqueue the lock request that will wait to be granted */
lock = lock_table_create(table, ulint(mode) | LOCK_WAIT, trx lock = lock_table_create(table, mode | LOCK_WAIT, trx
#ifdef WITH_WSREP #ifdef WITH_WSREP
, c_lock , c_lock
#endif #endif
@ -3834,7 +3832,7 @@ be granted immediately, the query thread is put to wait.
dberr_t dberr_t
lock_table( lock_table(
/*=======*/ /*=======*/
ulint flags, /*!< in: if BTR_NO_LOCKING_FLAG bit is set, unsigned flags, /*!< in: if BTR_NO_LOCKING_FLAG bit is set,
does nothing */ does nothing */
dict_table_t* table, /*!< in/out: database table dict_table_t* table, /*!< in/out: database table
in dictionary cache */ in dictionary cache */
@ -3899,14 +3897,14 @@ lock_table(
mode: this trx may have to wait */ mode: this trx may have to wait */
if (wait_for != NULL) { if (wait_for != NULL) {
err = lock_table_enqueue_waiting(ulint(mode) | flags, table, err = lock_table_enqueue_waiting(flags | mode, table,
thr thr
#ifdef WITH_WSREP #ifdef WITH_WSREP
, wait_for , wait_for
#endif #endif
); );
} else { } else {
lock_table_create(table, ulint(mode) | flags, trx); lock_table_create(table, flags | mode, trx);
ut_a(!flags || mode == LOCK_S || mode == LOCK_X); ut_a(!flags || mode == LOCK_S || mode == LOCK_X);
@ -5295,7 +5293,7 @@ lock_rec_insert_check_and_lock(
had to wait for their insert. Both had waiting gap type lock requests had to wait for their insert. Both had waiting gap type lock requests
on the successor, which produced an unnecessary deadlock. */ on the successor, which produced an unnecessary deadlock. */
const ulint type_mode = LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION; const unsigned type_mode = LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION;
if ( if (
#ifdef WITH_WSREP #ifdef WITH_WSREP
@ -5712,7 +5710,7 @@ lock_sec_rec_read_check_and_lock(
records: LOCK_S or LOCK_X; the records: LOCK_S or LOCK_X; the
latter is possible in latter is possible in
SELECT FOR UPDATE */ SELECT FOR UPDATE */
ulint gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP */ LOCK_REC_NOT_GAP */
que_thr_t* thr) /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
{ {
@ -5749,7 +5747,7 @@ lock_sec_rec_read_check_and_lock(
return DB_SUCCESS; return DB_SUCCESS;
} }
err = lock_rec_lock(FALSE, ulint(mode) | gap_mode, err = lock_rec_lock(FALSE, gap_mode | mode,
block, heap_no, index, thr); block, heap_no, index, thr);
ut_ad(lock_rec_queue_validate(FALSE, block, rec, index, offsets)); ut_ad(lock_rec_queue_validate(FALSE, block, rec, index, offsets));
@ -5782,7 +5780,7 @@ lock_clust_rec_read_check_and_lock(
records: LOCK_S or LOCK_X; the records: LOCK_S or LOCK_X; the
latter is possible in latter is possible in
SELECT FOR UPDATE */ SELECT FOR UPDATE */
ulint gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP */ LOCK_REC_NOT_GAP */
que_thr_t* thr) /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
{ {
@ -5814,7 +5812,7 @@ lock_clust_rec_read_check_and_lock(
return DB_SUCCESS; return DB_SUCCESS;
} }
err = lock_rec_lock(FALSE, ulint(mode) | gap_mode, err = lock_rec_lock(FALSE, gap_mode | mode,
block, heap_no, index, thr); block, heap_no, index, thr);
ut_ad(lock_rec_queue_validate(FALSE, block, rec, index, offsets)); ut_ad(lock_rec_queue_validate(FALSE, block, rec, index, offsets));
@ -5849,7 +5847,7 @@ lock_clust_rec_read_check_and_lock_alt(
records: LOCK_S or LOCK_X; the records: LOCK_S or LOCK_X; the
latter is possible in latter is possible in
SELECT FOR UPDATE */ SELECT FOR UPDATE */
ulint gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP */ LOCK_REC_NOT_GAP */
que_thr_t* thr) /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
{ {

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, 2019, MariaDB Corporation. Copyright (c) 2018, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -153,7 +153,7 @@ bool
lock_prdt_has_to_wait( lock_prdt_has_to_wait(
/*==================*/ /*==================*/
const trx_t* trx, /*!< in: trx of new lock */ const trx_t* trx, /*!< in: trx of new lock */
ulint type_mode,/*!< in: precise mode of the new lock unsigned type_mode,/*!< in: precise mode of the new lock
to set: LOCK_S or LOCK_X, possibly to set: LOCK_S or LOCK_X, possibly
ORed to LOCK_PREDICATE or LOCK_PRDT_PAGE, ORed to LOCK_PREDICATE or LOCK_PRDT_PAGE,
LOCK_INSERT_INTENTION */ LOCK_INSERT_INTENTION */
@ -228,7 +228,7 @@ lock_t*
lock_prdt_has_lock( lock_prdt_has_lock(
/*===============*/ /*===============*/
ulint precise_mode, /*!< in: LOCK_S or LOCK_X */ ulint precise_mode, /*!< in: LOCK_S or LOCK_X */
ulint type_mode, /*!< in: LOCK_PREDICATE etc. */ unsigned type_mode, /*!< in: LOCK_PREDICATE etc. */
const buf_block_t* block, /*!< in: buffer block const buf_block_t* block, /*!< in: buffer block
containing the record */ containing the record */
lock_prdt_t* prdt, /*!< in: The predicate to be lock_prdt_t* prdt, /*!< in: The predicate to be
@ -285,7 +285,7 @@ static
lock_t* lock_t*
lock_prdt_other_has_conflicting( lock_prdt_other_has_conflicting(
/*============================*/ /*============================*/
ulint mode, /*!< in: LOCK_S or LOCK_X, unsigned mode, /*!< in: LOCK_S or LOCK_X,
possibly ORed to LOCK_PREDICATE or possibly ORed to LOCK_PREDICATE or
LOCK_PRDT_PAGE, LOCK_INSERT_INTENTION */ LOCK_PRDT_PAGE, LOCK_INSERT_INTENTION */
const buf_block_t* block, /*!< in: buffer block containing const buf_block_t* block, /*!< in: buffer block containing
@ -385,7 +385,7 @@ static
lock_t* lock_t*
lock_prdt_find_on_page( lock_prdt_find_on_page(
/*===================*/ /*===================*/
ulint type_mode, /*!< in: lock type_mode field */ unsigned type_mode, /*!< in: lock type_mode field */
const buf_block_t* block, /*!< in: buffer block */ const buf_block_t* block, /*!< in: buffer block */
lock_prdt_t* prdt, /*!< in: MBR with the lock */ lock_prdt_t* prdt, /*!< in: MBR with the lock */
const trx_t* trx) /*!< in: transaction */ const trx_t* trx) /*!< in: transaction */
@ -423,7 +423,7 @@ static
lock_t* lock_t*
lock_prdt_add_to_queue( lock_prdt_add_to_queue(
/*===================*/ /*===================*/
ulint type_mode,/*!< in: lock mode, wait, predicate unsigned type_mode,/*!< in: lock mode, wait, predicate
etc. flags; type is ignored etc. flags; type is ignored
and replaced by LOCK_REC */ and replaced by LOCK_REC */
const buf_block_t* block, /*!< in: buffer block containing const buf_block_t* block, /*!< in: buffer block containing
@ -677,7 +677,7 @@ lock_prdt_update_split_low(
lock_prdt_t* new_prdt, /*!< in: MBR on the new page */ lock_prdt_t* new_prdt, /*!< in: MBR on the new page */
ulint space, /*!< in: space id */ ulint space, /*!< in: space id */
ulint page_no, /*!< in: page number */ ulint page_no, /*!< in: page number */
ulint type_mode) /*!< in: LOCK_PREDICATE or unsigned type_mode) /*!< in: LOCK_PREDICATE or
LOCK_PRDT_PAGE */ LOCK_PRDT_PAGE */
{ {
lock_t* lock; lock_t* lock;
@ -797,7 +797,7 @@ lock_prdt_lock(
records: LOCK_S or LOCK_X; the records: LOCK_S or LOCK_X; the
latter is possible in latter is possible in
SELECT FOR UPDATE */ SELECT FOR UPDATE */
ulint type_mode, unsigned type_mode,
/*!< in: LOCK_PREDICATE or LOCK_PRDT_PAGE */ /*!< in: LOCK_PREDICATE or LOCK_PRDT_PAGE */
que_thr_t* thr) /*!< in: query thread que_thr_t* thr) /*!< in: query thread
(can be NULL if BTR_NO_LOCKING_FLAG) */ (can be NULL if BTR_NO_LOCKING_FLAG) */
@ -825,7 +825,7 @@ lock_prdt_lock(
lock_mutex_enter(); lock_mutex_enter();
const ulint prdt_mode = ulint(mode) | type_mode; const unsigned prdt_mode = type_mode | mode;
lock_t* lock = lock_rec_get_first_on_page(hash, block); lock_t* lock = lock_rec_get_first_on_page(hash, block);
if (lock == NULL) { if (lock == NULL) {
@ -833,7 +833,7 @@ lock_prdt_lock(
#ifdef WITH_WSREP #ifdef WITH_WSREP
NULL, NULL, /* FIXME: replicate SPATIAL INDEX locks */ NULL, NULL, /* FIXME: replicate SPATIAL INDEX locks */
#endif #endif
ulint(mode) | type_mode, block, PRDT_HEAPNO, prdt_mode, block, PRDT_HEAPNO,
index, trx, FALSE); index, trx, FALSE);
status = LOCK_REC_SUCCESS_CREATED; status = LOCK_REC_SUCCESS_CREATED;
@ -865,7 +865,7 @@ lock_prdt_lock(
NULL, /* FIXME: replicate NULL, /* FIXME: replicate
SPATIAL INDEX locks */ SPATIAL INDEX locks */
#endif #endif
ulint(mode) | type_mode, prdt_mode,
block, PRDT_HEAPNO, block, PRDT_HEAPNO,
index, thr, prdt); index, thr, prdt);
} else { } else {
@ -1012,7 +1012,7 @@ lock_prdt_rec_move(
lock != NULL; lock != NULL;
lock = lock_rec_get_next(PRDT_HEAPNO, lock)) { lock = lock_rec_get_next(PRDT_HEAPNO, lock)) {
const ulint type_mode = lock->type_mode; const auto type_mode = lock->type_mode;
lock_prdt_t* lock_prdt = lock_get_prdt_from_lock(lock); lock_prdt_t* lock_prdt = lock_get_prdt_from_lock(lock);
lock_rec_reset_nth_bit(lock, PRDT_HEAPNO); lock_rec_reset_nth_bit(lock, PRDT_HEAPNO);

View File

@ -259,7 +259,7 @@ ATTRIBUTE_COLD bool log_crypt_101_read_checkpoint(const byte* buf)
} }
} }
if (infos_used >= UT_ARR_SIZE(infos)) { if (infos_used >= UT_ARR_SIZE(infos)) {
ut_ad(!"too many checkpoint pages"); ut_ad("too many checkpoint pages" == 0);
goto next_slot; goto next_slot;
} }
infos_used++; infos_used++;

View File

@ -207,7 +207,7 @@ static void memo_slot_release(mtr_memo_slot_t *slot)
switch (slot->type) { switch (slot->type) {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
default: default:
ut_ad(!"invalid type"); ut_ad("invalid type" == 0);
break; break;
case MTR_MEMO_MODIFY: case MTR_MEMO_MODIFY:
break; break;
@ -243,7 +243,7 @@ struct ReleaseLatches {
switch (slot->type) { switch (slot->type) {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
default: default:
ut_ad(!"invalid type"); ut_ad("invalid type" == 0);
break; break;
case MTR_MEMO_MODIFY: case MTR_MEMO_MODIFY:
break; break;

View File

@ -4189,7 +4189,6 @@ os_aio_print(FILE* file)
{ {
time_t current_time; time_t current_time;
double time_elapsed; double time_elapsed;
double avg_bytes_read;
for (ulint i = 0; i < srv_n_file_io_threads; ++i) { for (ulint i = 0; i < srv_n_file_io_threads; ++i) {
fprintf(file, "I/O thread " ULINTPF " state: %s (%s)", fprintf(file, "I/O thread " ULINTPF " state: %s (%s)",
@ -4228,22 +4227,20 @@ os_aio_print(FILE* file)
n_reads, n_writes); n_reads, n_writes);
} }
if (os_n_file_reads == os_n_file_reads_old) { ulint avg_bytes_read = (os_n_file_reads == os_n_file_reads_old)
avg_bytes_read = 0.0; ? 0
} else { : os_bytes_read_since_printout
avg_bytes_read = (double) os_bytes_read_since_printout / (os_n_file_reads - os_n_file_reads_old);
/ (os_n_file_reads - os_n_file_reads_old);
}
fprintf(file, fprintf(file,
"%.2f reads/s, " ULINTPF " avg bytes/read," "%.2f reads/s, " ULINTPF " avg bytes/read,"
" %.2f writes/s, %.2f fsyncs/s\n", " %.2f writes/s, %.2f fsyncs/s\n",
(os_n_file_reads - os_n_file_reads_old) static_cast<double>(os_n_file_reads - os_n_file_reads_old)
/ time_elapsed, / time_elapsed,
(ulint) avg_bytes_read, avg_bytes_read,
(os_n_file_writes - os_n_file_writes_old) static_cast<double>(os_n_file_writes - os_n_file_writes_old)
/ time_elapsed, / time_elapsed,
(os_n_fsyncs - os_n_fsyncs_old) static_cast<double>(os_n_fsyncs - os_n_fsyncs_old)
/ time_elapsed); / time_elapsed);
os_n_file_reads_old = os_n_file_reads; os_n_file_reads_old = os_n_file_reads;

View File

@ -1452,7 +1452,7 @@ inc_dir:
case REC_STATUS_INFIMUM: case REC_STATUS_INFIMUM:
break; break;
case REC_STATUS_SUPREMUM: case REC_STATUS_SUPREMUM:
ut_ad(!"wrong status on cur->rec"); ut_ad("wrong status on cur->rec" == 0);
} }
switch (rec_get_status(rec)) { switch (rec_get_status(rec)) {
case REC_STATUS_NODE_PTR: case REC_STATUS_NODE_PTR:
@ -1471,7 +1471,7 @@ inc_dir:
break; break;
case REC_STATUS_INFIMUM: case REC_STATUS_INFIMUM:
case REC_STATUS_SUPREMUM: case REC_STATUS_SUPREMUM:
ut_ad(!"wrong status on rec"); ut_ad("wrong status on rec" == 0);
} }
ut_ad(rec_get_status(next_rec) != REC_STATUS_INFIMUM); ut_ad(rec_get_status(next_rec) != REC_STATUS_INFIMUM);
#endif #endif
@ -2671,7 +2671,7 @@ corrupted:
memcpy(buf, &prev_rec[-REC_N_NEW_EXTRA_BYTES - hdr_c], hdr_c); memcpy(buf, &prev_rec[-REC_N_NEW_EXTRA_BYTES - hdr_c], hdr_c);
buf+= hdr_c; buf+= hdr_c;
*buf++= (enc_hdr_l & 3) << 4; /* info_bits; n_owned=0 */ *buf++= static_cast<byte>((enc_hdr_l & 3) << 4); /* info_bits; n_owned=0 */
*buf++= static_cast<byte>(h >> 5); /* MSB of heap number */ *buf++= static_cast<byte>(h >> 5); /* MSB of heap number */
h= (h & ((1U << 5) - 1)) << 3; h= (h & ((1U << 5) - 1)) << 3;
static_assert(REC_STATUS_ORDINARY == 0, "compatibility"); static_assert(REC_STATUS_ORDINARY == 0, "compatibility");

View File

@ -1120,7 +1120,8 @@ cmp_rec_rec(
no need to compare the child page number. */ no need to compare the child page number. */
n_fields = std::min(rec_offs_n_fields(offsets1), n_fields = std::min(rec_offs_n_fields(offsets1),
rec_offs_n_fields(offsets2)); rec_offs_n_fields(offsets2));
n_fields = std::min(n_fields, dict_index_get_n_unique_in_tree(index)); n_fields = std::min<ulint>(n_fields,
dict_index_get_n_unique_in_tree(index));
for (; cur_field < n_fields; cur_field++) { for (; cur_field < n_fields; cur_field++) {
ulint mtype; ulint mtype;

View File

@ -2676,8 +2676,9 @@ wsrep_rec_get_foreign_key(
memcpy(buf, data, len); memcpy(buf, data, len);
*buf_len = wsrep_innobase_mysql_sort( *buf_len = wsrep_innobase_mysql_sort(
(int)(col_f->prtype & DATA_MYSQL_TYPE_MASK), (int)(col_f->prtype & DATA_MYSQL_TYPE_MASK),
(uint)dtype_get_charset_coll(col_f->prtype), dtype_get_charset_coll(col_f->prtype),
buf, len, *buf_len); buf, static_cast<uint>(len),
static_cast<uint>(*buf_len));
} else { /* new protocol */ } else { /* new protocol */
if (!(col_r->prtype & DATA_NOT_NULL)) { if (!(col_r->prtype & DATA_NOT_NULL)) {
*buf++ = 0; *buf++ = 0;
@ -2710,9 +2711,9 @@ wsrep_rec_get_foreign_key(
len = wsrep_innobase_mysql_sort( len = wsrep_innobase_mysql_sort(
(int) (int)
(col_f->prtype & DATA_MYSQL_TYPE_MASK), (col_f->prtype & DATA_MYSQL_TYPE_MASK),
(uint)
dtype_get_charset_coll(col_f->prtype), dtype_get_charset_coll(col_f->prtype),
buf, len, *buf_len); buf, static_cast<uint>(len),
static_cast<uint>(*buf_len));
break; break;
case DATA_BLOB: case DATA_BLOB:
case DATA_BINARY: case DATA_BINARY:

View File

@ -635,7 +635,7 @@ row_merge_fts_doc_tokenize(
field->type.mtype = DATA_INT; field->type.mtype = DATA_INT;
field->type.prtype = DATA_NOT_NULL | DATA_BINARY_TYPE; field->type.prtype = DATA_NOT_NULL | DATA_BINARY_TYPE;
field->type.len = len; field->type.len = field->len;
field->type.mbminlen = 0; field->type.mbminlen = 0;
field->type.mbmaxlen = 0; field->type.mbmaxlen = 0;
@ -659,7 +659,7 @@ row_merge_fts_doc_tokenize(
field->type.mtype = DATA_INT; field->type.mtype = DATA_INT;
field->type.prtype = DATA_NOT_NULL; field->type.prtype = DATA_NOT_NULL;
field->type.len = len; field->type.len = 4;
field->type.mbminlen = 0; field->type.mbminlen = 0;
field->type.mbmaxlen = 0; field->type.mbmaxlen = 0;
cur_len += len; cur_len += len;

View File

@ -1392,7 +1392,7 @@ row_import::set_root_by_name() UNIV_NOTHROW
/* We've already checked that it exists. */ /* We've already checked that it exists. */
ut_a(index != 0); ut_a(index != 0);
index->page = cfg_index->m_page_no; index->page = static_cast<uint32_t>(cfg_index->m_page_no);
} }
} }
@ -1451,9 +1451,8 @@ row_import::set_root_by_heuristic() UNIV_NOTHROW
cfg_index[i].m_srv_index = index; cfg_index[i].m_srv_index = index;
index->page = cfg_index[i].m_page_no; index->page = static_cast<uint32_t>(
cfg_index[i++].m_page_no);
++i;
} }
} }
@ -2445,7 +2444,7 @@ row_import_cfg_read_string(
break; break;
} else if (ch != 0) { } else if (ch != 0) {
if (len < max_len) { if (len < max_len) {
ptr[len++] = ch; ptr[len++] = static_cast<byte>(ch);
} else { } else {
break; break;
} }
@ -2825,12 +2824,12 @@ row_import_read_columns(
col->len = mach_read_from_4(ptr); col->len = mach_read_from_4(ptr);
ptr += sizeof(ib_uint32_t); ptr += sizeof(ib_uint32_t);
ulint mbminmaxlen = mach_read_from_4(ptr); uint32_t mbminmaxlen = mach_read_from_4(ptr);
col->mbmaxlen = mbminmaxlen / 5; col->mbmaxlen = mbminmaxlen / 5;
col->mbminlen = mbminmaxlen % 5; col->mbminlen = mbminmaxlen % 5;
ptr += sizeof(ib_uint32_t); ptr += sizeof(ib_uint32_t);
col->ind = mach_read_from_4(ptr); col->ind = mach_read_from_4(ptr) & dict_index_t::MAX_N_FIELDS;
ptr += sizeof(ib_uint32_t); ptr += sizeof(ib_uint32_t);
col->ord_part = mach_read_from_4(ptr); col->ord_part = mach_read_from_4(ptr);

View File

@ -483,7 +483,7 @@ row_ins_cascade_calc_update_vec(
ulint i; ulint i;
ulint j; ulint j;
bool doc_id_updated = false; bool doc_id_updated = false;
ulint doc_id_pos = 0; unsigned doc_id_pos = 0;
doc_id_t new_doc_id = FTS_NULL_DOC_ID; doc_id_t new_doc_id = FTS_NULL_DOC_ID;
ulint prefix_col; ulint prefix_col;
@ -540,10 +540,9 @@ row_ins_cascade_calc_update_vec(
ufield = update->fields + n_fields_updated; ufield = update->fields + n_fields_updated;
ufield->field_no ufield->field_no = dict_table_get_nth_col_pos(
= dict_table_get_nth_col_pos( table, dict_col_get_no(col),
table, dict_col_get_no(col), &prefix_col);
&prefix_col);
ufield->orig_len = 0; ufield->orig_len = 0;
ufield->exp = NULL; ufield->exp = NULL;
@ -1487,7 +1486,7 @@ static
dberr_t dberr_t
row_ins_set_shared_rec_lock( row_ins_set_shared_rec_lock(
/*========================*/ /*========================*/
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP type lock */ LOCK_REC_NOT_GAP type lock */
const buf_block_t* block, /*!< in: buffer block of rec */ const buf_block_t* block, /*!< in: buffer block of rec */
const rec_t* rec, /*!< in: record */ const rec_t* rec, /*!< in: record */
@ -1518,7 +1517,7 @@ static
dberr_t dberr_t
row_ins_set_exclusive_rec_lock( row_ins_set_exclusive_rec_lock(
/*===========================*/ /*===========================*/
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOCK_REC_NOT_GAP type lock */ LOCK_REC_NOT_GAP type lock */
const buf_block_t* block, /*!< in: buffer block of rec */ const buf_block_t* block, /*!< in: buffer block of rec */
const rec_t* rec, /*!< in: record */ const rec_t* rec, /*!< in: record */

View File

@ -970,7 +970,7 @@ row_log_table_low(
ut_ad(page_get_page_no(page_align(rec)) == index->page); ut_ad(page_get_page_no(page_align(rec)) == index->page);
break; break;
default: default:
ut_ad(!"wrong page type"); ut_ad("wrong page type" == 0);
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
ut_ad(!rec_is_metadata(rec, *index)); ut_ad(!rec_is_metadata(rec, *index));

View File

@ -364,8 +364,7 @@ row_merge_buf_create(
mem_heap_t* heap; mem_heap_t* heap;
max_tuples = srv_sort_buf_size max_tuples = srv_sort_buf_size
/ ut_max(static_cast<ulint>(1), / std::max<ulint>(1, dict_index_get_min_size(index));
dict_index_get_min_size(index));
buf_size = (sizeof *buf); buf_size = (sizeof *buf);
@ -2712,7 +2711,8 @@ write_buffers:
/* Update progress for each 1000 rows */ /* Update progress for each 1000 rows */
curr_progress = (read_rows >= table_total_rows) ? curr_progress = (read_rows >= table_total_rows) ?
pct_cost : pct_cost :
((pct_cost * read_rows) / table_total_rows); pct_cost * static_cast<double>(read_rows)
/ static_cast<double>(table_total_rows);
/* presenting 10.12% as 1012 integer */ /* presenting 10.12% as 1012 integer */
onlineddl_pct_progress = (ulint) (curr_progress * 100); onlineddl_pct_progress = (ulint) (curr_progress * 100);
} }
@ -3344,7 +3344,8 @@ row_merge_sort(
merge_count++; merge_count++;
curr_progress = (merge_count >= total_merge_sort_count) ? curr_progress = (merge_count >= total_merge_sort_count) ?
pct_cost : pct_cost :
((pct_cost * merge_count) / total_merge_sort_count); pct_cost * static_cast<double>(merge_count)
/ static_cast<double>(total_merge_sort_count);
/* presenting 10.12% as 1012 integer */; /* presenting 10.12% as 1012 integer */;
onlineddl_pct_progress = (ulint) ((pct_progress + curr_progress) * 100); onlineddl_pct_progress = (ulint) ((pct_progress + curr_progress) * 100);
} }
@ -3642,7 +3643,8 @@ row_merge_insert_index_tuples(
curr_progress = (inserted_rows >= table_total_rows || curr_progress = (inserted_rows >= table_total_rows ||
table_total_rows <= 0) ? table_total_rows <= 0) ?
pct_cost : pct_cost :
((pct_cost * inserted_rows) / table_total_rows); pct_cost * static_cast<double>(inserted_rows)
/ static_cast<double>(table_total_rows);
/* presenting 10.12% as 1012 integer */; /* presenting 10.12% as 1012 integer */;
onlineddl_pct_progress = (ulint) ((pct_progress + curr_progress) * 100); onlineddl_pct_progress = (ulint) ((pct_progress + curr_progress) * 100);
@ -4477,8 +4479,10 @@ row_merge_build_indexes(
merge_files[i].n_rec = 0; merge_files[i].n_rec = 0;
} }
total_static_cost = COST_BUILD_INDEX_STATIC * n_indexes + COST_READ_CLUSTERED_INDEX; total_static_cost = COST_BUILD_INDEX_STATIC
total_dynamic_cost = COST_BUILD_INDEX_DYNAMIC * n_indexes; * static_cast<double>(n_indexes) + COST_READ_CLUSTERED_INDEX;
total_dynamic_cost = COST_BUILD_INDEX_DYNAMIC
* static_cast<double>(n_indexes);
for (i = 0; i < n_indexes; i++) { for (i = 0; i < n_indexes; i++) {
if (indexes[i]->type & DICT_FTS) { if (indexes[i]->type & DICT_FTS) {
ibool opt_doc_id_size = FALSE; ibool opt_doc_id_size = FALSE;
@ -4601,9 +4605,10 @@ row_merge_build_indexes(
sort_idx, table, col_map, 0}; sort_idx, table, col_map, 0};
pct_cost = (COST_BUILD_INDEX_STATIC + pct_cost = (COST_BUILD_INDEX_STATIC +
(total_dynamic_cost * merge_files[k].offset / (total_dynamic_cost
total_index_blocks)) / * static_cast<double>(merge_files[k].offset)
(total_static_cost + total_dynamic_cost) / static_cast<double>(total_index_blocks)))
/ (total_static_cost + total_dynamic_cost)
* PCT_COST_MERGESORT_INDEX * 100; * PCT_COST_MERGESORT_INDEX * 100;
char* bufend = innobase_convert_name( char* bufend = innobase_convert_name(
buf, sizeof buf, buf, sizeof buf,
@ -4650,10 +4655,14 @@ row_merge_build_indexes(
BtrBulk btr_bulk(sort_idx, trx); BtrBulk btr_bulk(sort_idx, trx);
pct_cost = (COST_BUILD_INDEX_STATIC + pct_cost = (COST_BUILD_INDEX_STATIC +
(total_dynamic_cost * merge_files[k].offset / (total_dynamic_cost
total_index_blocks)) / * static_cast<double>(
(total_static_cost + total_dynamic_cost) * merge_files[k].offset)
PCT_COST_INSERT_INDEX * 100; / static_cast<double>(
total_index_blocks)))
/ (total_static_cost
+ total_dynamic_cost)
* PCT_COST_INSERT_INDEX * 100;
if (global_system_variables.log_warnings > 2) { if (global_system_variables.log_warnings > 2) {
sql_print_information( sql_print_information(

View File

@ -1920,7 +1920,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt)
&& trx->fts_next_doc_id != UINT64_UNDEFINED) { && trx->fts_next_doc_id != UINT64_UNDEFINED) {
err = row_fts_update_or_delete(prebuilt); err = row_fts_update_or_delete(prebuilt);
if (UNIV_UNLIKELY(err != DB_SUCCESS)) { if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ut_ad(!"unexpected error"); ut_ad("unexpected error" == 0);
goto error; goto error;
} }
} }

View File

@ -907,7 +907,7 @@ row_purge_parse_undo_rec(
break; break;
default: default:
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ut_ad(!"unknown undo log record type"); ut_ad("unknown undo log record type" == 0);
return false; return false;
case TRX_UNDO_UPD_DEL_REC: case TRX_UNDO_UPD_DEL_REC:
case TRX_UNDO_UPD_EXIST_REC: case TRX_UNDO_UPD_EXIST_REC:

View File

@ -958,25 +958,17 @@ row_sel_get_clust_rec(
if (!node->read_view) { if (!node->read_view) {
/* Try to place a lock on the index record */ /* Try to place a lock on the index record */
ulint lock_type; trx_t* trx = thr_get_trx(thr);
trx_t* trx;
trx = thr_get_trx(thr);
/* At READ UNCOMMITTED or READ COMMITTED isolation level /* At READ UNCOMMITTED or READ COMMITTED isolation level
we lock only the record, i.e., next-key locking is we lock only the record, i.e., next-key locking is
not used. */ not used. */
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
lock_type = LOCK_REC_NOT_GAP;
} else {
lock_type = LOCK_ORDINARY;
}
err = lock_clust_rec_read_check_and_lock( err = lock_clust_rec_read_check_and_lock(
0, btr_pcur_get_block(&plan->clust_pcur), 0, btr_pcur_get_block(&plan->clust_pcur),
clust_rec, index, offsets, clust_rec, index, offsets,
static_cast<lock_mode>(node->row_lock_mode), node->row_lock_mode,
lock_type, trx->isolation_level <= TRX_ISO_READ_COMMITTED
? LOCK_REC_NOT_GAP : LOCK_ORDINARY,
thr); thr);
switch (err) { switch (err) {
@ -1069,8 +1061,8 @@ sel_set_rtr_rec_lock(
const rec_t* first_rec,/*!< in: record */ const rec_t* first_rec,/*!< in: record */
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint mode, /*!< in: lock mode */ unsigned mode, /*!< in: lock mode */
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOC_REC_NOT_GAP */ LOC_REC_NOT_GAP */
que_thr_t* thr, /*!< in: query thread */ que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
@ -1235,8 +1227,8 @@ sel_set_rec_lock(
const rec_t* rec, /*!< in: record */ const rec_t* rec, /*!< in: record */
dict_index_t* index, /*!< in: index */ dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint mode, /*!< in: lock mode */ unsigned mode, /*!< in: lock mode */
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or unsigned type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOC_REC_NOT_GAP */ LOC_REC_NOT_GAP */
que_thr_t* thr, /*!< in: query thread */ que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
@ -1727,7 +1719,7 @@ rec_loop:
if (!consistent_read) { if (!consistent_read) {
rec_t* next_rec = page_rec_get_next(rec); rec_t* next_rec = page_rec_get_next(rec);
ulint lock_type; unsigned lock_type;
trx_t* trx; trx_t* trx;
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
@ -1790,7 +1782,7 @@ skip_lock:
if (!consistent_read) { if (!consistent_read) {
/* Try to place a lock on the index record */ /* Try to place a lock on the index record */
ulint lock_type; unsigned lock_type;
trx_t* trx; trx_t* trx;
offsets = rec_get_offsets(rec, index, offsets, true, offsets = rec_get_offsets(rec, index, offsets, true,
@ -3379,7 +3371,7 @@ Row_sel_get_clust_rec_for_mysql::operator()(
err = lock_clust_rec_read_check_and_lock( err = lock_clust_rec_read_check_and_lock(
0, btr_pcur_get_block(prebuilt->clust_pcur), 0, btr_pcur_get_block(prebuilt->clust_pcur),
clust_rec, clust_index, *offsets, clust_rec, clust_index, *offsets,
static_cast<lock_mode>(prebuilt->select_lock_type), prebuilt->select_lock_type,
LOCK_REC_NOT_GAP, LOCK_REC_NOT_GAP,
thr); thr);
@ -4911,7 +4903,7 @@ wrong_offs:
is a non-delete marked record, then it is enough to lock its is a non-delete marked record, then it is enough to lock its
existence with LOCK_REC_NOT_GAP. */ existence with LOCK_REC_NOT_GAP. */
ulint lock_type; unsigned lock_type;
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) { if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
/* At READ COMMITTED or READ UNCOMMITTED /* At READ COMMITTED or READ UNCOMMITTED

View File

@ -379,7 +379,7 @@ static bool row_undo_ins_parse_undo_rec(undo_node_t* node, bool dict_locked)
switch (node->rec_type) { switch (node->rec_type) {
default: default:
ut_ad(!"wrong undo record type"); ut_ad("wrong undo record type" == 0);
goto close_table; goto close_table;
case TRX_UNDO_INSERT_METADATA: case TRX_UNDO_INSERT_METADATA:
case TRX_UNDO_INSERT_REC: case TRX_UNDO_INSERT_REC:
@ -536,7 +536,7 @@ row_undo_ins(
switch (node->rec_type) { switch (node->rec_type) {
default: default:
ut_ad(!"wrong undo record type"); ut_ad("wrong undo record type" == 0);
/* fall through */ /* fall through */
case TRX_UNDO_INSERT_REC: case TRX_UNDO_INSERT_REC:
/* Skip the clustered index (the first index) */ /* Skip the clustered index (the first index) */

View File

@ -1269,7 +1269,7 @@ close_table:
if (node->update->info_bits & REC_INFO_MIN_REC_FLAG) { if (node->update->info_bits & REC_INFO_MIN_REC_FLAG) {
if ((node->update->info_bits & ~REC_INFO_DELETED_FLAG) if ((node->update->info_bits & ~REC_INFO_DELETED_FLAG)
!= REC_INFO_MIN_REC_FLAG) { != REC_INFO_MIN_REC_FLAG) {
ut_ad(!"wrong info_bits in undo log record"); ut_ad("wrong info_bits in undo log record" == 0);
goto close_table; goto close_table;
} }
/* This must be an undo log record for a subsequent /* This must be an undo log record for a subsequent

View File

@ -435,7 +435,7 @@ row_undo(
err = row_undo_mod(node, thr); err = row_undo_mod(node, thr);
break; break;
default: default:
ut_ad(!"wrong state"); ut_ad("wrong state" == 0);
err = DB_CORRUPTION; err = DB_CORRUPTION;
} }

View File

@ -1203,15 +1203,12 @@ row_upd_replace_vcol(
ptr += 2; ptr += 2;
while (ptr != end_ptr) { while (ptr != end_ptr) {
const byte* field; const byte* field;
ulint field_no; uint32_t field_no, len, orig_len;
ulint len;
ulint orig_len;
bool is_v;
field_no = mach_read_next_compressed(&ptr); field_no = mach_read_next_compressed(&ptr);
is_v = (field_no >= REC_MAX_N_FIELDS); const bool is_v = (field_no >= REC_MAX_N_FIELDS);
if (is_v) { if (is_v) {
ptr = trx_undo_read_v_idx( ptr = trx_undo_read_v_idx(
@ -1223,7 +1220,7 @@ row_upd_replace_vcol(
ptr = trx_undo_rec_get_col_val( ptr = trx_undo_rec_get_col_val(
ptr, &field, &len, &orig_len); ptr, &field, &len, &orig_len);
if (field_no == ULINT_UNDEFINED) { if (field_no == FIL_NULL) {
ut_ad(is_v); ut_ad(is_v);
continue; continue;
} }

View File

@ -88,7 +88,8 @@ srv_enter_innodb_with_tickets(
to enter InnoDB */ to enter InnoDB */
{ {
trx->declared_to_be_inside_innodb = TRUE; trx->declared_to_be_inside_innodb = TRUE;
trx->n_tickets_to_enter_innodb = srv_n_free_tickets_to_enter; trx->n_tickets_to_enter_innodb = static_cast<uint32_t>(
srv_n_free_tickets_to_enter);
} }
/*********************************************************************//** /*********************************************************************//**

View File

@ -276,8 +276,8 @@ double srv_adaptive_flushing_lwm;
adaptive flushing is averaged */ adaptive flushing is averaged */
ulong srv_flushing_avg_loops; ulong srv_flushing_avg_loops;
/** innodb_purge_threads; the number of purge threads to use */ /** innodb_purge_threads; the number of purge tasks to use */
ulong srv_n_purge_threads; uint srv_n_purge_threads;
/** innodb_purge_batch_size, in pages */ /** innodb_purge_batch_size, in pages */
ulong srv_purge_batch_size; ulong srv_purge_batch_size;
@ -995,15 +995,15 @@ srv_printf_innodb_monitor(
fprintf(file, fprintf(file,
"%.2f hash searches/s, %.2f non-hash searches/s\n", "%.2f hash searches/s, %.2f non-hash searches/s\n",
(btr_cur_n_sea - btr_cur_n_sea_old) static_cast<double>(btr_cur_n_sea - btr_cur_n_sea_old)
/ time_elapsed, / time_elapsed,
(btr_cur_n_non_sea - btr_cur_n_non_sea_old) static_cast<double>(btr_cur_n_non_sea - btr_cur_n_non_sea_old)
/ time_elapsed); / time_elapsed);
btr_cur_n_sea_old = btr_cur_n_sea; btr_cur_n_sea_old = btr_cur_n_sea;
#else /* BTR_CUR_HASH_ADAPT */ #else /* BTR_CUR_HASH_ADAPT */
fprintf(file, fprintf(file,
"%.2f non-hash searches/s\n", "%.2f non-hash searches/s\n",
(btr_cur_n_non_sea - btr_cur_n_non_sea_old) static_cast<double>(btr_cur_n_non_sea - btr_cur_n_non_sea_old)
/ time_elapsed); / time_elapsed);
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
btr_cur_n_non_sea_old = btr_cur_n_non_sea; btr_cur_n_non_sea_old = btr_cur_n_non_sea;
@ -1062,13 +1062,17 @@ srv_printf_innodb_monitor(
fprintf(file, fprintf(file,
"%.2f inserts/s, %.2f updates/s," "%.2f inserts/s, %.2f updates/s,"
" %.2f deletes/s, %.2f reads/s\n", " %.2f deletes/s, %.2f reads/s\n",
((ulint) srv_stats.n_rows_inserted - srv_n_rows_inserted_old) static_cast<double>(srv_stats.n_rows_inserted
- srv_n_rows_inserted_old)
/ time_elapsed, / time_elapsed,
((ulint) srv_stats.n_rows_updated - srv_n_rows_updated_old) static_cast<double>(srv_stats.n_rows_updated
- srv_n_rows_updated_old)
/ time_elapsed, / time_elapsed,
((ulint) srv_stats.n_rows_deleted - srv_n_rows_deleted_old) static_cast<double>(srv_stats.n_rows_deleted
- srv_n_rows_deleted_old)
/ time_elapsed, / time_elapsed,
((ulint) srv_stats.n_rows_read - srv_n_rows_read_old) static_cast<double>(srv_stats.n_rows_read
- srv_n_rows_read_old)
/ time_elapsed); / time_elapsed);
fprintf(file, fprintf(file,
"Number of system rows inserted " ULINTPF "Number of system rows inserted " ULINTPF
@ -1081,14 +1085,18 @@ srv_printf_innodb_monitor(
fprintf(file, fprintf(file,
"%.2f inserts/s, %.2f updates/s," "%.2f inserts/s, %.2f updates/s,"
" %.2f deletes/s, %.2f reads/s\n", " %.2f deletes/s, %.2f reads/s\n",
((ulint) srv_stats.n_system_rows_inserted static_cast<double>(srv_stats.n_system_rows_inserted
- srv_n_system_rows_inserted_old) / time_elapsed, - srv_n_system_rows_inserted_old)
((ulint) srv_stats.n_system_rows_updated / time_elapsed,
- srv_n_system_rows_updated_old) / time_elapsed, static_cast<double>(srv_stats.n_system_rows_updated
((ulint) srv_stats.n_system_rows_deleted - srv_n_system_rows_updated_old)
- srv_n_system_rows_deleted_old) / time_elapsed, / time_elapsed,
((ulint) srv_stats.n_system_rows_read static_cast<double>(srv_stats.n_system_rows_deleted
- srv_n_system_rows_read_old) / time_elapsed); - srv_n_system_rows_deleted_old)
/ time_elapsed,
static_cast<double>(srv_stats.n_system_rows_read
- srv_n_system_rows_read_old)
/ time_elapsed);
srv_n_rows_inserted_old = srv_stats.n_rows_inserted; srv_n_rows_inserted_old = srv_stats.n_rows_inserted;
srv_n_rows_updated_old = srv_stats.n_rows_updated; srv_n_rows_updated_old = srv_stats.n_rows_updated;
srv_n_rows_deleted_old = srv_stats.n_rows_deleted; srv_n_rows_deleted_old = srv_stats.n_rows_deleted;

View File

@ -1556,7 +1556,7 @@ file_checked:
break; break;
case SRV_OPERATION_RESTORE_DELTA: case SRV_OPERATION_RESTORE_DELTA:
case SRV_OPERATION_BACKUP: case SRV_OPERATION_BACKUP:
ut_ad(!"wrong mariabackup mode"); ut_ad("wrong mariabackup mode" == 0);
} }
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {

View File

@ -968,7 +968,8 @@ sync_array_print_long_waits_low(
const void** sema, /*!< out: longest-waited-for semaphore */ const void** sema, /*!< out: longest-waited-for semaphore */
ibool* noticed)/*!< out: TRUE if long wait noticed */ ibool* noticed)/*!< out: TRUE if long wait noticed */
{ {
ulint fatal_timeout = srv_fatal_semaphore_wait_threshold; double fatal_timeout = static_cast<double>(
srv_fatal_semaphore_wait_threshold);
ibool fatal = FALSE; ibool fatal = FALSE;
double longest_diff = 0; double longest_diff = 0;
ulint i; ulint i;

View File

@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2020, MariaDB Corporation.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
@ -143,15 +144,18 @@ sync_print_wait_info(FILE* file)
fprintf(file, fprintf(file,
"Spin rounds per wait: %.2f RW-shared," "Spin rounds per wait: %.2f RW-shared,"
" %.2f RW-excl, %.2f RW-sx\n", " %.2f RW-excl, %.2f RW-sx\n",
(double) rw_lock_stats.rw_s_spin_round_count / rw_lock_stats.rw_s_spin_wait_count
(rw_lock_stats.rw_s_spin_wait_count ? static_cast<double>(rw_lock_stats.rw_s_spin_round_count) /
? rw_lock_stats.rw_s_spin_wait_count : 1LL), static_cast<double>(rw_lock_stats.rw_s_spin_wait_count)
(double) rw_lock_stats.rw_x_spin_round_count / : static_cast<double>(rw_lock_stats.rw_s_spin_round_count),
(rw_lock_stats.rw_x_spin_wait_count rw_lock_stats.rw_x_spin_wait_count
? rw_lock_stats.rw_x_spin_wait_count : 1LL), ? static_cast<double>(rw_lock_stats.rw_x_spin_round_count) /
(double) rw_lock_stats.rw_sx_spin_round_count / static_cast<double>(rw_lock_stats.rw_x_spin_wait_count)
(rw_lock_stats.rw_sx_spin_wait_count : static_cast<double>(rw_lock_stats.rw_x_spin_round_count),
? rw_lock_stats.rw_sx_spin_wait_count : 1LL)); rw_lock_stats.rw_sx_spin_wait_count
? static_cast<double>(rw_lock_stats.rw_sx_spin_round_count) /
static_cast<double>(rw_lock_stats.rw_sx_spin_wait_count)
: static_cast<double>(rw_lock_stats.rw_sx_spin_round_count));
} }
/** /**

View File

@ -733,7 +733,7 @@ static bool fill_locks_row(
row->lock_mode = 9; row->lock_mode = 9;
break; break;
default: default:
ut_ad(!"unknown lock mode"); ut_ad("unknown lock mode" == 0);
row->lock_mode = 0; row->lock_mode = 0;
} }

View File

@ -1209,9 +1209,8 @@ trx_purge_dml_delay(void)
without holding trx_sys.mutex. */ without holding trx_sys.mutex. */
if (srv_max_purge_lag > 0) { if (srv_max_purge_lag > 0) {
float ratio; double ratio = static_cast<double>(trx_sys.rseg_history_len) /
static_cast<double>(srv_max_purge_lag);
ratio = float(trx_sys.rseg_history_len) / srv_max_purge_lag;
if (ratio > 1.0) { if (ratio > 1.0) {
/* If the history list length exceeds the /* If the history list length exceeds the

View File

@ -174,7 +174,7 @@ trx_undo_log_v_idx(
indexed, and return its position indexed, and return its position
@param[in] table the table @param[in] table the table
@param[in] ptr undo log pointer @param[in] ptr undo log pointer
@param[out] col_pos the column number or ULINT_UNDEFINED @param[out] col_pos the column number or FIL_NULL
if the column is not indexed any more if the column is not indexed any more
@return remaining part of undo log record after reading these values */ @return remaining part of undo log record after reading these values */
static static
@ -182,12 +182,12 @@ const byte*
trx_undo_read_v_idx_low( trx_undo_read_v_idx_low(
const dict_table_t* table, const dict_table_t* table,
const byte* ptr, const byte* ptr,
ulint* col_pos) uint32_t* col_pos)
{ {
ulint len = mach_read_from_2(ptr); ulint len = mach_read_from_2(ptr);
const byte* old_ptr = ptr; const byte* old_ptr = ptr;
*col_pos = ULINT_UNDEFINED; *col_pos = FIL_NULL;
ptr += 2; ptr += 2;
@ -235,7 +235,7 @@ still indexed, and output its position
check to see if this is undo log. When check to see if this is undo log. When
first_v_col is true, is_undo_log is output, first_v_col is true, is_undo_log is output,
when first_v_col is false, is_undo_log is input when first_v_col is false, is_undo_log is input
@param[in,out] field_no the column number @param[out] field_no the column number, or FIL_NULL if not indexed
@return remaining part of undo log record after reading these values */ @return remaining part of undo log record after reading these values */
const byte* const byte*
trx_undo_read_v_idx( trx_undo_read_v_idx(
@ -243,7 +243,7 @@ trx_undo_read_v_idx(
const byte* ptr, const byte* ptr,
bool first_v_col, bool first_v_col,
bool* is_undo_log, bool* is_undo_log,
ulint* field_no) uint32_t* field_no)
{ {
/* Version marker only put on the first virtual column */ /* Version marker only put on the first virtual column */
if (first_v_col) { if (first_v_col) {
@ -493,8 +493,8 @@ byte*
trx_undo_rec_get_col_val( trx_undo_rec_get_col_val(
const byte* ptr, const byte* ptr,
const byte** field, const byte** field,
ulint* len, uint32_t* len,
ulint* orig_len) uint32_t* orig_len)
{ {
*len = mach_read_next_compressed(&ptr); *len = mach_read_next_compressed(&ptr);
*orig_len = 0; *orig_len = 0;
@ -567,8 +567,7 @@ trx_undo_rec_get_row_ref(
for (i = 0; i < ref_len; i++) { for (i = 0; i < ref_len; i++) {
const byte* field; const byte* field;
ulint len; uint32_t len, orig_len;
ulint orig_len;
dfield_t* dfield = dtuple_get_nth_field(tuple, i); dfield_t* dfield = dtuple_get_nth_field(tuple, i);
@ -601,8 +600,7 @@ trx_undo_rec_skip_row_ref(
for (i = 0; i < ref_len; i++) { for (i = 0; i < ref_len; i++) {
const byte* field; const byte* field;
ulint len; uint32_t len, orig_len;
ulint orig_len;
ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len); ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len);
} }
@ -1486,12 +1484,11 @@ trx_undo_update_rec_get_update(
/* Store then the updated ordinary columns to the update vector */ /* Store then the updated ordinary columns to the update vector */
for (ulint i = 0; i < n_fields; i++) { for (ulint i = 0; i < n_fields; i++) {
const byte* field; const byte* field;
ulint len; uint32_t len, orig_len;
ulint orig_len;
upd_field = upd_get_nth_field(update, i); upd_field = upd_get_nth_field(update, i);
ulint field_no = mach_read_next_compressed(&ptr); uint32_t field_no = mach_read_next_compressed(&ptr);
const bool is_virtual = (field_no >= REC_MAX_N_FIELDS); const bool is_virtual = (field_no >= REC_MAX_N_FIELDS);
@ -1503,7 +1500,7 @@ trx_undo_update_rec_get_update(
&field_no); &field_no);
first_v_col = false; first_v_col = false;
/* This column could be dropped or no longer indexed */ /* This column could be dropped or no longer indexed */
if (field_no == ULINT_UNDEFINED) { if (field_no == FIL_NULL) {
/* Mark this is no longer needed */ /* Mark this is no longer needed */
upd_field->field_no = REC_MAX_N_FIELDS; upd_field->field_no = REC_MAX_N_FIELDS;
@ -1570,7 +1567,8 @@ trx_undo_update_rec_get_update(
field_no), field_no),
&upd_field->new_val.type); &upd_field->new_val.type);
} }
upd_field->field_no = field_no; upd_field->field_no = field_no
& dict_index_t::MAX_N_FIELDS;
} else if (field_no < index->n_fields) { } else if (field_no < index->n_fields) {
upd_field_set_field_no(upd_field, field_no, index); upd_field_set_field_no(upd_field, field_no, index);
} else { } else {
@ -1712,15 +1710,13 @@ trx_undo_rec_get_partial_row(
while (ptr != end_ptr) { while (ptr != end_ptr) {
dfield_t* dfield; dfield_t* dfield;
const byte* field; const byte* field;
ulint field_no; uint32_t field_no;
const dict_col_t* col; const dict_col_t* col;
ulint len; uint32_t len, orig_len;
ulint orig_len;
bool is_virtual;
field_no = mach_read_next_compressed(&ptr); field_no = mach_read_next_compressed(&ptr);
is_virtual = (field_no >= REC_MAX_N_FIELDS); const bool is_virtual = (field_no >= REC_MAX_N_FIELDS);
if (is_virtual) { if (is_virtual) {
ptr = trx_undo_read_v_idx( ptr = trx_undo_read_v_idx(
@ -1732,7 +1728,7 @@ trx_undo_rec_get_partial_row(
ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len); ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len);
/* This column could be dropped or no longer indexed */ /* This column could be dropped or no longer indexed */
if (field_no == ULINT_UNDEFINED) { if (field_no == FIL_NULL) {
ut_ad(is_virtual); ut_ad(is_virtual);
continue; continue;
} }
@ -2484,17 +2480,14 @@ trx_undo_read_v_cols(
end_ptr = ptr + mach_read_from_2(ptr); end_ptr = ptr + mach_read_from_2(ptr);
ptr += 2; ptr += 2;
while (ptr < end_ptr) { while (ptr < end_ptr) {
dfield_t* dfield; dfield_t* dfield;
const byte* field; const byte* field;
ulint field_no; uint32_t field_no, len, orig_len;
ulint len;
ulint orig_len;
bool is_virtual;
field_no = mach_read_next_compressed( field_no = mach_read_next_compressed(
const_cast<const byte**>(&ptr)); const_cast<const byte**>(&ptr));
is_virtual = (field_no >= REC_MAX_N_FIELDS); const bool is_virtual = (field_no >= REC_MAX_N_FIELDS);
if (is_virtual) { if (is_virtual) {
ptr = trx_undo_read_v_idx( ptr = trx_undo_read_v_idx(
@ -2509,7 +2502,7 @@ trx_undo_read_v_cols(
/* The virtual column is no longer indexed or does not exist. /* The virtual column is no longer indexed or does not exist.
This needs to put after trx_undo_rec_get_col_val() so the This needs to put after trx_undo_rec_get_col_val() so the
undo ptr advances */ undo ptr advances */
if (field_no == ULINT_UNDEFINED) { if (field_no == FIL_NULL) {
ut_ad(is_virtual); ut_ad(is_virtual);
continue; continue;
} }