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 (pclmul_enabled) {
uint32_t crc_accum = crc ^ 0xffffffffL;
uint32_t crc_accum = (uint32_t) ~crc;
crc32_intel_pclmul(&crc_accum, buf, len);
return crc_accum ^ 0xffffffffL;
return ~crc_accum;
}
#endif
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
NUMERIC_MIN_VALUE 1
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 @@
SESSION_VALUE NULL
DEFAULT_VALUE 56

View file

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

View file

@ -1035,7 +1035,7 @@ btr_free_root_check(
@param[in,out] mtr mini-transaction
@return page number of the created root
@retval FIL_NULL if did not succeed */
ulint
uint32_t
btr_create(
ulint type,
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;
default:
ut_ad(!"wrong page type");
ut_ad("wrong page type" == 0);
/* fall through */
case FIL_PAGE_INDEX:
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)) {
default:
ut_ad(!"wrong page type");
ut_ad("wrong page type" == 0);
return true;
case FIL_PAGE_INDEX:
/* 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_INFIMUM:
case REC_STATUS_SUPREMUM:
ut_ad(!"wrong record status in update");
ut_ad("wrong record status in update" == 0);
}
}
#endif /* UNIV_DEBUG */
@ -5871,7 +5871,7 @@ discard_page:
<< block->page.id
<< " in index " << index->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) {
n_sample_pages = (srv_stats_transient_sample_pages < index->stat_index_size) ?
ut_min(static_cast<ulint>(index->stat_index_size),
static_cast<ulint>(log2(index->stat_index_size)*srv_stats_transient_sample_pages))
ut_min(index->stat_index_size,
static_cast<ulint>(log2(index->stat_index_size)*double(srv_stats_transient_sample_pages)))
: index->stat_index_size;
}

View file

@ -666,8 +666,9 @@ btr_defragment_n_pages(
max_data_size = optimal_page_size;
}
reserved_space = ut_min((ulint)(optimal_page_size
* (1 - srv_defragment_fill_factor)),
reserved_space = ut_min(static_cast<ulint>(
static_cast<double>(optimal_page_size)
* (1 - srv_defragment_fill_factor)),
(data_size_per_rec
* srv_defragment_fill_factor_n_recs));
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
if (srv_numa_interleave) {
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
int st = mbind(chunk->mem, chunk->mem_size(),
MPOL_INTERLEAVE,
numa_mems_allowed->maskp,
numa_mems_allowed->size,
MPOL_MF_MOVE);
if (st != 0) {
if (mbind(chunk->mem, chunk->mem_size(),
MPOL_INTERLEAVE,
numa_mems_allowed->maskp,
numa_mems_allowed->size,
MPOL_MF_MOVE)) {
ib::warn() << "Failed to set NUMA memory policy of"
" buffer pool page frames to MPOL_INTERLEAVE"
" (error: " << strerror(errno) << ").";
@ -2427,7 +2426,7 @@ static void buf_pool_resize()
buf_resize_status("Withdrawing blocks to be shrunken.");
time_t withdraw_started = time(NULL);
ulint message_interval = 60;
double message_interval = 60;
ulint retry_interval = 1;
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->page_made_young_rate =
(buf_pool->stat.n_pages_made_young
- buf_pool->old_stat.n_pages_made_young) / time_elapsed;
static_cast<double>(buf_pool->stat.n_pages_made_young
- buf_pool->old_stat.n_pages_made_young)
/ time_elapsed;
pool_info->page_not_made_young_rate =
(buf_pool->stat.n_pages_not_made_young
- buf_pool->old_stat.n_pages_not_made_young) / time_elapsed;
static_cast<double>(buf_pool->stat.n_pages_not_made_young
- buf_pool->old_stat.n_pages_not_made_young)
/ time_elapsed;
pool_info->pages_read_rate =
(buf_pool->stat.n_pages_read
- buf_pool->old_stat.n_pages_read) / time_elapsed;
static_cast<double>(buf_pool->stat.n_pages_read
- buf_pool->old_stat.n_pages_read)
/ time_elapsed;
pool_info->pages_created_rate =
(buf_pool->stat.n_pages_created
- buf_pool->old_stat.n_pages_created) / time_elapsed;
static_cast<double>(buf_pool->stat.n_pages_created
- buf_pool->old_stat.n_pages_created)
/ time_elapsed;
pool_info->pages_written_rate =
(buf_pool->stat.n_pages_written
- buf_pool->old_stat.n_pages_written) / time_elapsed;
static_cast<double>(buf_pool->stat.n_pages_written
- buf_pool->old_stat.n_pages_written)
/ time_elapsed;
pool_info->n_page_get_delta = buf_pool->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;
}
pool_info->pages_readahead_rnd_rate =
(buf_pool->stat.n_ra_pages_read_rnd
- buf_pool->old_stat.n_ra_pages_read_rnd) / time_elapsed;
static_cast<double>(buf_pool->stat.n_ra_pages_read_rnd
- buf_pool->old_stat.n_ra_pages_read_rnd)
/ time_elapsed;
pool_info->pages_readahead_rate =
(buf_pool->stat.n_ra_pages_read
- buf_pool->old_stat.n_ra_pages_read) / time_elapsed;
static_cast<double>(buf_pool->stat.n_ra_pages_read
- buf_pool->old_stat.n_ra_pages_read)
/ time_elapsed;
pool_info->pages_evicted_rate =
(buf_pool->stat.n_ra_pages_evicted
- buf_pool->old_stat.n_ra_pages_evicted) / time_elapsed;
static_cast<double>(buf_pool->stat.n_ra_pages_evicted
- buf_pool->old_stat.n_ra_pages_evicted)
/ time_elapsed;
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->old_lru_len,
pool_info->flush_list_len,
(((double) pool_info->flush_list_len) /
(pool_info->lru_len + pool_info->free_list_len + 1.0)) * 100.0,
static_cast<double>(pool_info->flush_list_len)
/ (static_cast<double>(pool_info->lru_len
+ pool_info->free_list_len) + 1.0)
* 100.0,
srv_max_buf_pool_modified_pct,
pool_info->n_pend_reads,
pool_info->n_pending_flush_lru,
@ -6229,8 +6238,9 @@ buf_print_io_instance(
pool_info->pages_written_rate);
if (pool_info->n_page_get_delta) {
double hit_rate = double(pool_info->page_read_delta)
/ pool_info->n_page_get_delta;
double hit_rate = static_cast<double>(
pool_info->page_read_delta)
/ static_cast<double>(pool_info->n_page_get_delta);
if (hit_rate > 1) {
hit_rate = 1;
@ -6241,10 +6251,11 @@ buf_print_io_instance(
" young-making rate " ULINTPF " / 1000 not "
ULINTPF " / 1000\n",
ulint(1000 * (1 - hit_rate)),
ulint(1000 * double(pool_info->young_making_delta)
/ pool_info->n_page_get_delta),
ulint(1000
* double(pool_info->young_making_delta)
/ double(pool_info->n_page_get_delta)),
ulint(1000 * double(pool_info->not_young_making_delta)
/ pool_info->n_page_get_delta));
/ double(pool_info->n_page_get_delta)));
} else {
fputs("No buffer pool page gets since the last printout\n",
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)
{
/* Calculate the start offset in a page */
uint srclen= srv_page_size - (FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION +
FIL_PAGE_FCRC32_CHECKSUM);
uint srclen= static_cast<uint>(srv_page_size) -
(FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION +
FIL_PAGE_FCRC32_CHECKSUM);
const byte* src= s + 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
pool (including the flush_list) was emptied while we are
looking at it) */
double dirty_pct = double(100 * dirty)
/ (1 + UT_LIST_GET_LEN(buf_pool->LRU)
+ UT_LIST_GET_LEN(buf_pool->free));
double dirty_pct = 100 * static_cast<double>(dirty)
/ static_cast<double>(1 + UT_LIST_GET_LEN(buf_pool->LRU)
+ UT_LIST_GET_LEN(buf_pool->free));
ut_a(srv_max_dirty_pages_pct_lwm
<= srv_max_buf_pool_modified_pct);
@ -2276,8 +2277,9 @@ af_get_pct_for_lsn(
{
lsn_t max_async_age;
lsn_t lsn_age_factor;
lsn_t af_lwm = (lsn_t) ((srv_adaptive_flushing_lwm
* log_get_capacity()) / 100);
lsn_t af_lwm = static_cast<lsn_t>(
srv_adaptive_flushing_lwm
* static_cast<double>(log_get_capacity()) / 100);
if (age < af_lwm) {
/* No adaptive flushing. */
@ -2299,10 +2301,11 @@ af_get_pct_for_lsn(
lsn_age_factor = (age * 100) / max_async_age;
ut_ad(srv_max_io_capacity >= srv_io_capacity);
return(static_cast<ulint>(
((srv_max_io_capacity / srv_io_capacity)
* (lsn_age_factor * sqrt((double)lsn_age_factor)))
/ 7.5));
return static_cast<ulint>(
(static_cast<double>(srv_max_io_capacity / srv_io_capacity
* lsn_age_factor)
* 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
iterations to smooth out transition in workload. */
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) {
time_elapsed = 1;
@ -2360,7 +2363,7 @@ page_cleaner_flush_pages_recommendation(ulint last_pages_in)
avg_page_rate = static_cast<ulint>(
((static_cast<double>(sum_pages)
/ time_elapsed)
+ avg_page_rate) / 2);
+ static_cast<double>(avg_page_rate)) / 2);
/* How much LSN we have generated since last call. */
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, 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) {
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) {
/* 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;

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.
@return position in internal representation of the clustered index */
ulint
unsigned
dict_table_get_nth_col_pos(
/*=======================*/
const dict_table_t* table, /*!< in: table */
ulint n, /*!< in: column number */
ulint* prefix_col_pos)
{
return(dict_index_get_nth_col_pos(dict_table_get_first_index(table),
n, prefix_col_pos));
ulint pos= dict_index_get_nth_col_pos(dict_table_get_first_index(table),
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 */
{
dict_col_t* col;
ulint i;
unsigned i;
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(!heap == !name);
@ -370,7 +370,6 @@ dict_mem_table_add_v_col(
ulint num_base)
{
dict_v_col_t* v_col;
ulint i;
ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
@ -378,7 +377,7 @@ dict_mem_table_add_v_col(
ut_ad(prtype & DATA_VIRTUAL);
i = table->n_v_def++;
unsigned i = table->n_v_def++;
table->n_t_def++;
@ -412,7 +411,8 @@ dict_mem_table_add_v_col(
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 */
ut_ad(v_col->v_indexes.empty());
@ -704,8 +704,7 @@ dict_mem_fill_column_struct(
ulint prtype, /*!< in: precise type */
ulint col_len) /*!< in: column length */
{
ulint mbminlen;
ulint mbmaxlen;
unsigned mbminlen, mbmaxlen;
column->ind = (unsigned int) col_pos;
column->ord_part = 0;
@ -1202,7 +1201,7 @@ inline void dict_index_t::reconstruct_fields()
}
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.
@ -1326,7 +1325,7 @@ dict_index_t::vers_history_row(
} else {
ib::error() << "foreign constraints: secondary index is out of "
"sync";
ut_ad(!"secondary index is out of sync");
ut_ad("secondary index is out of sync" == 0);
error = true;
}
mtr.commit();

View file

@ -2247,10 +2247,7 @@ fil_crypt_set_rotation_iops(
/*********************************************************************
Adjust encrypt tables
@param[in] val New setting for innodb-encrypt-tables */
UNIV_INTERN
void
fil_crypt_set_encrypt_tables(
uint val)
void fil_crypt_set_encrypt_tables(ulong val)
{
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);
}
ut_ad(!"unhandled innodb_checksum_algorithm");
ut_ad("unhandled innodb_checksum_algorithm" == 0);
return false;
}

View file

@ -86,13 +86,13 @@ static ulint fil_page_compress_low(
byte* out_buf,
ulint header_len,
ulint comp_algo,
ulint comp_level)
unsigned comp_level)
{
ulint write_size = srv_page_size - header_len;
switch (comp_algo) {
default:
ut_ad(!"unknown compression method");
ut_ad("unknown compression method" == 0);
/* fall through */
case PAGE_UNCOMPRESSED:
return 0;
@ -211,7 +211,8 @@ static ulint fil_page_compress_for_full_crc32(
ulint write_size = fil_page_compress_low(
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) {
fail:
@ -459,7 +460,9 @@ static bool fil_page_decompress_low(
return LZ4_decompress_safe(
reinterpret_cast<const char*>(buf) + header_len,
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 */
#ifdef HAVE_LZO
case PAGE_LZO_ALGORITHM:
@ -488,12 +491,12 @@ static bool fil_page_decompress_low(
#ifdef HAVE_BZIP2
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(
reinterpret_cast<char*>(tmp_buf),
&dst_pos,
reinterpret_cast<char*>(buf) + header_len,
actual_size, 1, 0)
static_cast<uint>(actual_size), 1, 0)
&& dst_pos == srv_page_size;
}
#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));
/* Clear or set XDES_FREE_BIT. */
byte val= free
? *b | 1 << (index & 7)
: *b & ~(1 << (index & 7));
? static_cast<byte>(*b | 1 << (index & 7))
: static_cast<byte>(*b & ~(1 << (index & 7)));
mtr->write<1>(block, b, val);
}
@ -520,7 +520,7 @@ void fil_space_t::modify_check(const mtr_t& mtr) const
return;
}
ut_ad(!"invalid log mode");
ut_ad("invalid log mode" == 0);
}
#endif

View file

@ -1280,7 +1280,7 @@ fts_cache_node_add_positions(
} else if (new_size < 48) {
new_size = 48;
} else {
new_size = (ulint)(1.2 * new_size);
new_size = new_size * 6 / 5;
}
ilist = static_cast<byte*>(ut_malloc_nokey(new_size));
@ -4176,7 +4176,8 @@ fts_sync_commit(
<< ": SYNC time: "
<< (time(NULL) - sync->start_time)
<< " secs: elapsed "
<< (double) n_nodes / elapsed_time
<< static_cast<double>(n_nodes)
/ static_cast<double>(elapsed_time)
<< " ins/sec";
}
@ -5268,7 +5269,9 @@ fts_update_doc_id(
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));
/* It is possible we update record that has

View file

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

View file

@ -1850,5 +1850,6 @@ err_exit:
}
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(
/*====================*/
ulint cset, /*!< in: MySQL charset-collation code */
ulint* mbminlen, /*!< out: minimum length of a char (in bytes) */
ulint* mbmaxlen) /*!< out: maximum length of a char (in bytes) */
unsigned*mbminlen, /*!< out: minimum length of a char (in bytes) */
unsigned*mbmaxlen) /*!< out: maximum length of a char (in bytes) */
{
CHARSET_INFO* cs;
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
are matched up between those in mysql and InnoDB. */
for (; key_part != key_end; ++key_part) {
ulint col_type;
ibool is_unsigned;
ulint mtype = innodb_idx_fld->col->mtype;
unsigned is_unsigned;
auto mtype = innodb_idx_fld->col->mtype;
/* Need to translate to InnoDB column type before
comparison. */
col_type = get_innobase_type_from_mysql_type(
auto col_type = get_innobase_type_from_mysql_type(
&is_unsigned, key_part->field);
/* Ignore InnoDB specific system columns. */
@ -6059,7 +6058,7 @@ no_such_table:
}
/* 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
|| m_prebuilt->table->is_temporary()
@ -6274,7 +6273,7 @@ wsrep_innobase_mysql_sort(
int mysql_type, /* in: MySQL type */
uint charset_number, /* in: number of the charset */
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 */
unsigned int buf_length) /* in: total str buffer length */
@ -6299,7 +6298,7 @@ wsrep_innobase_mysql_sort(
case MYSQL_TYPE_VARCHAR:
{
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
the comparison. Since the MySQL function get_charset may be
@ -6326,13 +6325,13 @@ wsrep_innobase_mysql_sort(
memcpy(tmp_str, str, str_length);
tmp_length = charset->strnxfrm(str, str_length,
str_length, tmp_str,
uint(str_length), tmp_str,
tmp_length, 0);
DBUG_ASSERT(tmp_length <= str_length);
if (wsrep_protocol_version < 3) {
tmp_length = charset->strnxfrm(
str, str_length,
str_length, tmp_str, tmp_length, 0);
uint(str_length), tmp_str, tmp_length, 0);
DBUG_ASSERT(tmp_length <= str_length);
} else {
/* strnxfrm will expand the destination string,
@ -6341,7 +6340,7 @@ wsrep_innobase_mysql_sort(
*/
tmp_length = charset->strnxfrm(
str, buf_length,
str_length, tmp_str, str_length, 0);
uint(str_length), tmp_str, str_length, 0);
DBUG_ASSERT(tmp_length <= buf_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'
@param[in] f MySQL Field
@return DATA_BINARY, DATA_VARCHAR, ... */
ulint
get_innobase_type_from_mysql_type(
ulint* unsigned_flag,
const void* f)
unsigned
get_innobase_type_from_mysql_type(unsigned *unsigned_flag, const Field *field)
{
const class Field* field = reinterpret_cast<const class Field*>(f);
/* 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
the type */
DBUG_ASSERT((ulint)MYSQL_TYPE_STRING < 256);
DBUG_ASSERT((ulint)MYSQL_TYPE_VAR_STRING < 256);
DBUG_ASSERT((ulint)MYSQL_TYPE_DOUBLE < 256);
DBUG_ASSERT((ulint)MYSQL_TYPE_FLOAT < 256);
DBUG_ASSERT((ulint)MYSQL_TYPE_DECIMAL < 256);
static_assert(MYSQL_TYPE_STRING < 256, "compatibility");
static_assert(MYSQL_TYPE_VAR_STRING < 256, "compatibility");
static_assert(MYSQL_TYPE_DOUBLE < 256, "compatibility");
static_assert(MYSQL_TYPE_FLOAT < 256, "compatibility");
static_assert(MYSQL_TYPE_DECIMAL < 256, "compatibility");
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.
@return key value length as stored in buff */
UNIV_INTERN
uint
static
uint16_t
wsrep_store_key_val_for_row(
/*=========================*/
THD* thd,
@ -6699,7 +6694,7 @@ wsrep_store_key_val_for_row(
format) */
uint buff_len,/*!< in: buffer length */
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_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");
memset(buff, 0, buff_len);
*key_is_null = TRUE;
*key_is_null = true;
for (; key_part != end; key_part++) {
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 (buff_space > 0) {
if (record[key_part->null_offset]
& key_part->null_bit) {
*buff = 1;
part_is_null = TRUE;
part_is_null = true;
} else {
*buff = 0;
}
@ -6735,7 +6730,7 @@ wsrep_store_key_val_for_row(
wsrep_thd_query(thd));
}
}
if (!part_is_null) *key_is_null = FALSE;
if (!part_is_null) *key_is_null = false;
field = key_part->field;
mysql_type = field->type();
@ -6985,7 +6980,7 @@ wsrep_store_key_val_for_row(
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 */
/**************************************************************//**
@ -8053,7 +8048,7 @@ calc_row_difference(
ibool changes_fts_doc_col = FALSE;
trx_t* const trx = prebuilt->trx;
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);
ut_ad(!srv_read_only_mode);
@ -8285,9 +8280,11 @@ calc_row_difference(
num_v++;
ut_ad(field != table->found_next_number_field);
} else {
ufield->field_no = dict_col_get_clust_pos(
&prebuilt->table->cols[i - num_v],
clust_index);
ufield->field_no = static_cast<unsigned>(
dict_col_get_clust_pos(
&prebuilt->table->cols
[i - num_v],
clust_index));
ufield->old_v_val = NULL;
if (field != table->found_next_number_field
|| dfield_is_null(&ufield->new_val)) {
@ -9916,7 +9913,7 @@ wsrep_append_foreign_key(
THD* thd = (THD*)trx->mysql_thd;
ulint rcode = DB_SUCCESS;
char cache_key[513] = {'\0'};
int cache_key_len=0;
size_t cache_key_len=0;
if (!wsrep_on(trx->mysql_thd) ||
wsrep_thd_is_local(trx->mysql_thd) == false) {
@ -10190,12 +10187,11 @@ ha_innobase::wsrep_append_keys(
}
if (wsrep_protocol_version == 0) {
uint len;
char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\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,
record0, &is_null);
@ -10252,15 +10248,15 @@ ha_innobase::wsrep_append_keys(
referenced_by_foreign_key2(tab, idx)) ||
(!tab && referenced_by_foreign_key()))) {
ibool is_null0;
uint len0 = wsrep_store_key_val_for_row(
bool is_null0;
auto len0 = wsrep_store_key_val_for_row(
thd, table, i, key0,
WSREP_MAX_SUPPORTED_KEY_LENGTH,
record0, &is_null0);
if (record1) {
ibool is_null1;
uint len1 = wsrep_store_key_val_for_row(
bool is_null1;
auto len1= wsrep_store_key_val_for_row(
thd, table, i, key1,
WSREP_MAX_SUPPORTED_KEY_LENGTH,
record1, &is_null1);
@ -10393,20 +10389,17 @@ create_table_check_doc_id_col(
wrong type/name/size */
{
for (ulint i = 0; i < form->s->fields; i++) {
const Field* field;
ulint col_type;
ulint col_len;
ulint unsigned_type;
field = form->field[i];
const Field* field = form->field[i];
if (!field->stored_in_db()) {
continue;
}
col_type = get_innobase_type_from_mysql_type(
unsigned unsigned_type;
auto col_type = get_innobase_type_from_mysql_type(
&unsigned_type, field);
col_len = field->pack_length();
auto col_len = field->pack_length();
if (innobase_strcasecmp(field->field_name.str,
FTS_DOC_ID_COL_NAME) == 0) {
@ -10484,7 +10477,7 @@ innodb_base_col_setup(
const Field* field,
dict_v_col_t* v_col)
{
ulint n = 0;
unsigned n = 0;
prepare_vcol_for_base_setup(table, field, v_col);
@ -10561,10 +10554,8 @@ int
create_table_info_t::create_table_def()
{
dict_table_t* table;
ulint col_type;
ulint col_len;
ulint nulls_allowed;
ulint unsigned_type;
unsigned unsigned_type;
ulint binary_type;
ulint long_true_varchar;
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);
if (!col_type) {
@ -10682,7 +10673,11 @@ create_table_info_t::create_table_def()
" the table with an appropriate"
" column type.",
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;
@ -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
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)){
my_error(ER_WRONG_COLUMN_NAME, MYF(0),
field->field_name.str);
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);
goto err_col;
}
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++) {
KEY_PART_INFO* key_part = key->key_part + i;
ulint prefix_len;
ulint col_type;
ulint is_unsigned;
unsigned is_unsigned;
/* (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;
col_type = get_innobase_type_from_mysql_type(
auto col_type = get_innobase_type_from_mysql_type(
&is_unsigned, key_part->field);
if (DATA_LARGE_MTYPE(col_type)
@ -11771,7 +11761,7 @@ index_bad:
@param[in] str string which might include 'MERGE_THRESHOLD='
@return value parsed. 0 means not found or invalid value. */
static
ulint
unsigned
innobase_parse_merge_threshold(
THD* thd,
const char* str)
@ -11791,7 +11781,7 @@ innobase_parse_merge_threshold(
lint ret = atoi(pos);
if (ret > 0 && ret <= 50) {
return(static_cast<ulint>(ret));
return(static_cast<unsigned>(ret));
}
push_warning_printf(
@ -11814,8 +11804,8 @@ innobase_parse_hint_from_comment(
dict_table_t* table,
const TABLE_SHARE* table_share)
{
ulint merge_threshold_table;
ulint merge_threshold_index[MAX_KEY];
unsigned merge_threshold_table;
unsigned merge_threshold_index[MAX_KEY];
bool is_found[MAX_KEY];
if (table_share->comment.str != NULL) {
@ -12134,7 +12124,7 @@ foreign_push_index_error(trx_t* trx, const char* operation,
col_name);
return;
}
DBUG_ASSERT(!"unknown error");
DBUG_ASSERT("unknown error" == 0);
}
/** Find column or virtual column in table by its name.
@ -13798,8 +13788,8 @@ int ha_innobase::truncate()
HA_CREATE_INFO info;
mem_heap_t* heap = mem_heap_create(1000);
dict_table_t* ib_table = m_prebuilt->table;
const time_t update_time = ib_table->update_time;
const ulint stored_lock = m_prebuilt->stored_select_lock_type;
const auto update_time = ib_table->update_time;
const auto stored_lock = m_prebuilt->stored_select_lock_type;
info.init();
update_create_info_from_table(&info, table);
@ -14361,11 +14351,12 @@ innodb_rec_per_key(
rec_per_key calculation */
rec_per_key
= static_cast<rec_per_key_t>(records - n_null)
/ (n_diff - n_null);
/ static_cast<rec_per_key_t>(n_diff - n_null);
}
} else {
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) {
@ -14571,7 +14562,6 @@ ha_innobase::info_low(
}
if (flag & HA_STATUS_CONST) {
ulong i;
/* Verify the number of index in InnoDB and MySQL
matches up. If m_prebuilt->clust_index_was_generated
holds, InnoDB defines GEN_CLUST_INDEX internally */
@ -14620,7 +14610,7 @@ ha_innobase::info_low(
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;
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. */
UNIV_INTERN
int
wsrep_innobase_kill_one_trx(
/*========================*/
void * const bf_thd_ptr,
const trx_t * const bf_trx,
trx_t *victim_trx,
ibool signal)
wsrep_innobase_kill_one_trx(THD *bf_thd_ptr, const trx_t *bf_trx,
trx_t *victim_trx, bool signal)
{
ut_ad(lock_mutex_own());
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 */
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,
"Purge threads can be from 1 to 32. Default is 4.",
NULL, NULL,
4, /* Default setting */
1, /* Minimum value */
srv_max_purge_threads,/* Maximum value */
0);
"Number of tasks for purging transaction history",
NULL, NULL, 4, 1, 32, 0);
static MYSQL_SYSVAR_ULONG(sync_array_size, srv_sync_array_size,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,

View file

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

View file

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

View file

@ -2554,7 +2554,7 @@ ulint ibuf_merge_all()
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
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; ) {
ulint n_pag2;

View file

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

View file

@ -1,7 +1,7 @@
/*****************************************************************************
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
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 prtype, /*!< in: precise type (and collation) */
ulint* mbminlen, /*!< out: minimum length of a
unsigned* mbminlen, /*!< out: minimum length of a
multi-byte character */
ulint* mbmaxlen); /*!< out: maximum length of a
unsigned* mbmaxlen); /*!< out: maximum length of a
multi-byte character */
/**
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.
@return fixed size, or 0 */
UNIV_INLINE
ulint
unsigned
dtype_get_fixed_size_low(
/*=====================*/
ulint mtype, /*!< in: main type */
@ -415,7 +415,7 @@ dtype_get_fixed_size_low(
Returns the minimum size of a data type.
@return minimum size */
UNIV_INLINE
ulint
unsigned
dtype_get_min_size_low(
/*===================*/
ulint mtype, /*!< in: main type */

View file

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

View file

@ -1,7 +1,7 @@
/*****************************************************************************
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
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 */
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 */
dtuple_t* ind_row; /* index definition row built */
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.
@return minimum multi-byte char size, in bytes */
UNIV_INLINE
ulint
unsigned
dict_col_get_mbminlen(
/*==================*/
const dict_col_t* col) /*!< in: column */
@ -198,7 +198,7 @@ dict_col_get_mbminlen(
Gets the maximum number of bytes per character.
@return maximum multi-byte char size, in bytes */
UNIV_INLINE
ulint
unsigned
dict_col_get_mbmaxlen(
/*==================*/
const dict_col_t* col) /*!< in: column */
@ -254,7 +254,7 @@ dict_col_type_assert_equal(
Returns the minimum size of the column.
@return minimum size */
UNIV_INLINE
ulint
unsigned
dict_col_get_min_size(
/*==================*/
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.
@return fixed size, or 0 */
UNIV_INLINE
ulint
unsigned
dict_col_get_fixed_size(
/*====================*/
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.
@return SQL null storage size in ROW_FORMAT=REDUNDANT */
UNIV_INLINE
ulint
unsigned
dict_col_get_sql_null_size(
/*=======================*/
const dict_col_t* col, /*!< in: column */
@ -293,7 +293,7 @@ dict_col_get_sql_null_size(
Gets the column number.
@return col->ind, table column position (starting from 0) */
UNIV_INLINE
ulint
unsigned
dict_col_get_no(
/*============*/
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
columns of a table */
UNIV_INLINE
ulint
unsigned
dict_table_get_n_user_cols(
/*=======================*/
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.
@return number of columns of a table */
UNIV_INLINE
ulint
unsigned
dict_table_get_n_cols(
/*==================*/
const dict_table_t* table) /*!< in: table */
@ -720,7 +720,7 @@ dict_table_get_n_cols(
@param[in] table the table to check
@return number of virtual columns of a table */
UNIV_INLINE
ulint
unsigned
dict_table_get_n_v_cols(
const dict_table_t* table);
@ -799,7 +799,7 @@ dict_col_t*
dict_table_get_sys_col(
/*===================*/
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));
#else /* UNIV_DEBUG */
#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.
@return column number */
UNIV_INLINE
ulint
unsigned
dict_table_get_sys_col_no(
/*======================*/
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));
/********************************************************************//**
Returns the minimum data size of an index record.
@return minimum data size in bytes */
UNIV_INLINE
ulint
unsigned
dict_index_get_min_size(
/*====================*/
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.
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_fields(
/*====================*/
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.
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_unique(
/*====================*/
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.
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_unique_in_tree(
/*============================*/
const dict_index_t* index) /*!< in: an internal representation
@ -1051,7 +1051,7 @@ include page no field.
@param[in] index index
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_unique_in_tree_nonleaf(
const dict_index_t* index)
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.
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_ordering_defined_by_user(
/*======================================*/
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.
@return position in internal representation of the clustered index */
ulint
unsigned
dict_table_get_nth_col_pos(
/*=======================*/
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.
@return page number */
UNIV_INLINE
ulint
uint32_t
dict_index_get_page(
/*================*/
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) 2013, 2019, MariaDB Corporation.
Copyright (c) 2013, 2020, MariaDB Corporation.
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
@ -31,7 +31,7 @@ Created 1/8/1996 Heikki Tuuri
Gets the minimum number of bytes per character.
@return minimum multi-byte char size, in bytes */
UNIV_INLINE
ulint
unsigned
dict_col_get_mbminlen(
/*==================*/
const dict_col_t* col) /*!< in: column */
@ -42,7 +42,7 @@ dict_col_get_mbminlen(
Gets the maximum number of bytes per character.
@return maximum multi-byte char size, in bytes */
UNIV_INLINE
ulint
unsigned
dict_col_get_mbmaxlen(
/*==================*/
const dict_col_t* col) /*!< in: column */
@ -93,7 +93,7 @@ dict_col_type_assert_equal(
Returns the minimum size of the column.
@return minimum size */
UNIV_INLINE
ulint
unsigned
dict_col_get_min_size(
/*==================*/
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.
@return fixed size, or 0 */
UNIV_INLINE
ulint
unsigned
dict_col_get_fixed_size(
/*====================*/
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.
@return SQL null storage size in ROW_FORMAT=REDUNDANT */
UNIV_INLINE
ulint
unsigned
dict_col_get_sql_null_size(
/*=======================*/
const dict_col_t* col, /*!< in: column */
@ -143,7 +143,7 @@ dict_col_get_sql_null_size(
Gets the column number.
@return col->ind, table column position (starting from 0) */
UNIV_INLINE
ulint
unsigned
dict_col_get_no(
/*============*/
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
columns of a table */
UNIV_INLINE
ulint
unsigned
dict_table_get_n_user_cols(
/*=======================*/
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.
@return number of non-virtual columns of a table */
UNIV_INLINE
ulint
unsigned
dict_table_get_n_cols(
/*==================*/
const dict_table_t* table) /*!< in: table */
@ -277,7 +277,7 @@ dict_table_get_n_cols(
@param[in] table the table to check
@return number of virtual columns of a table */
UNIV_INLINE
ulint
unsigned
dict_table_get_n_v_cols(
const dict_table_t* table)
{
@ -296,7 +296,7 @@ dict_table_has_indexed_v_cols(
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);
if (col->m_col.ord_part) {
return(true);
@ -399,7 +399,7 @@ dict_col_t*
dict_table_get_sys_col(
/*===================*/
const dict_table_t* table, /*!< in: table */
ulint sys) /*!< in: DATA_ROW_ID, ... */
unsigned sys) /*!< in: DATA_ROW_ID, ... */
{
dict_col_t* col;
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.
@return column number */
UNIV_INLINE
ulint
unsigned
dict_table_get_sys_col_no(
/*======================*/
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(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.
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_fields(
/*====================*/
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.
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_unique(
/*====================*/
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.
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_unique_in_tree(
/*============================*/
const dict_index_t* index) /*!< in: an internal representation
@ -770,7 +770,7 @@ include page no field.
@param[in] index index
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_unique_in_tree_nonleaf(
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.
@return number of fields */
UNIV_INLINE
ulint
unsigned
dict_index_get_n_ordering_defined_by_user(
/*======================================*/
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.
@return minimum data size in bytes */
UNIV_INLINE
ulint
unsigned
dict_index_get_min_size(
/*====================*/
const dict_index_t* index) /*!< in: index */
{
ulint n = dict_index_get_n_fields(index);
ulint size = 0;
unsigned n= dict_index_get_n_fields(index);
unsigned size= 0;
while (n--) {
size += dict_col_get_min_size(dict_index_get_nth_col(index,
n));
}
while (n--)
size+= dict_col_get_min_size(dict_index_get_nth_col(index, n));
return(size);
return size;
}
/*********************************************************************//**
Gets the page number of the root of the index tree.
@return page number */
UNIV_INLINE
ulint
uint32_t
dict_index_get_page(
/*================*/
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) 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
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
initialized to 0, NULL or FALSE in dict_mem_index_create(). */
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 */
mem_heap_t* heap; /*!< memory heap */
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);
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);
std::sort(begin, end, [](const dict_field_t& a, const dict_field_t& b)
{ 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,
[ai_col](const dict_field_t& f)
{ 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
@param[in] val New setting for innodb-encrypt-tables */
UNIV_INTERN
void
fil_crypt_set_encrypt_tables(
uint val);
void fil_crypt_set_encrypt_tables(ulong val);
/*********************************************************************
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) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2020, MariaDB Corporation.
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
@ -36,6 +36,7 @@ simple headers.
/* Forward declarations */
class THD;
class Field;
// JAN: TODO missing features:
#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'
@param[in] f MySQL Field
@return DATA_BINARY, DATA_VARCHAR, ... */
ulint
get_innobase_type_from_mysql_type(
ulint* unsigned_flag,
const void* field);
unsigned
get_innobase_type_from_mysql_type(unsigned *unsigned_flag, const Field *field);
/******************************************************************//**
Get the variable length bounds of the given character set. */
@ -175,8 +174,8 @@ void
innobase_get_cset_width(
/*====================*/
ulint cset, /*!< in: MySQL charset-collation code */
ulint* mbminlen, /*!< out: minimum length of a char (in bytes) */
ulint* mbmaxlen); /*!< out: maximum length of a char (in bytes) */
unsigned*mbminlen, /*!< out: minimum length of a char (in bytes) */
unsigned*mbmaxlen); /*!< out: maximum length of a char (in bytes) */
/******************************************************************//**
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 */
#ifdef WITH_WSREP
UNIV_INTERN
int
wsrep_innobase_kill_one_trx(void * const thd_ptr,
const trx_t * const bf_trx,
trx_t *victim_trx,
ibool signal);
wsrep_innobase_kill_one_trx(THD *bf_thd, const trx_t *bf_trx,
trx_t *victim_trx, bool signal);
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);
#endif /* WITH_WSREP */

View file

@ -1,7 +1,7 @@
/*****************************************************************************
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
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
latter is possible in
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 */
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
latter is possible in
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 */
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
latter is possible in
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 */
que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((warn_unused_result));
@ -443,7 +443,7 @@ be granted immediately, the query thread is put to wait.
dberr_t
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 */
dict_table_t* table, /*!< in/out: database table
in dictionary cache */
@ -832,7 +832,7 @@ lock_rec_create(
lock_t* c_lock, /*!< conflicting lock */
que_thr_t* thr, /*!< thread owning trx */
#endif
ulint type_mode,/*!< in: lock mode and wait
unsigned type_mode,/*!< in: lock mode and wait
flag, type is ignored and
replaced by LOCK_REC */
const buf_block_t* block, /*!< in: buffer block containing
@ -871,7 +871,7 @@ lock_rec_create_low(
lock_t* c_lock, /*!< conflicting lock */
que_thr_t* thr, /*!< thread owning trx */
#endif
ulint type_mode,
unsigned type_mode,
ulint space,
ulint page_no,
const page_t* page,
@ -902,7 +902,7 @@ lock_rec_enqueue_waiting(
#ifdef WITH_WSREP
lock_t* c_lock, /*!< conflicting lock */
#endif
ulint type_mode,
unsigned type_mode,
const buf_block_t* block,
ulint heap_no,
dict_index_t* index,

View file

@ -110,7 +110,7 @@ lock_rec_create(
lock_t* c_lock, /*!< conflicting lock */
que_thr_t* thr, /*!< thread owning trx */
#endif
ulint type_mode,/*!< in: lock mode and wait
unsigned type_mode,/*!< in: lock mode and wait
flag, type is ignored and
replaced by LOCK_REC */
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) 2018, MariaDB Corporation.
Copyright (c) 2018, 2020, MariaDB Corporation.
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
@ -48,7 +48,7 @@ lock_prdt_lock(
records: LOCK_S or LOCK_X; the
latter is possible in
SELECT FOR UPDATE */
ulint type_mode,
unsigned type_mode,
/*!< in: LOCK_PREDICATE or LOCK_PRDT_PAGE */
que_thr_t* thr); /*!< in: query thread
(can be NULL if BTR_NO_LOCKING_FLAG) */
@ -90,7 +90,7 @@ bool
lock_prdt_has_to_wait(
/*==================*/
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
ORed to LOCK_PREDICATE or LOCK_PRDT_PAGE,
LOCK_INSERT_INTENTION */
@ -158,7 +158,7 @@ bool
lock_prdt_has_to_wait(
/*==================*/
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
ORed to LOCK_PREDICATE or LOCK_PRDT_PAGE,
LOCK_INSERT_INTENTION */

View file

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

View file

@ -685,8 +685,8 @@ struct row_prebuilt_t {
updated */
dtuple_t* clust_ref; /*!< prebuilt dtuple used in
sel/upd/del */
ulint select_lock_type;/*!< LOCK_NONE, LOCK_S, or LOCK_X */
ulint stored_select_lock_type;/*!< this field is used to
lock_mode select_lock_type;/*!< LOCK_NONE, LOCK_S, or LOCK_X */
lock_mode stored_select_lock_type;/*!< this field is used to
remember the original select_lock_type
that was decided in ha_innodb.cc,
::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
delete, which means that a row x-lock
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 fetch_table; /*!< number of the next table to access
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_LIMIT (~0UL)
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
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_function[];
/* the number of purge threads to use from the worker pool (currently 0 or 1) */
extern ulong srv_n_purge_threads;
/** innodb_purge_threads; the number of purge tasks to use */
extern uint srv_n_purge_threads;
/* the number of pages to purge in one batch */
extern ulong srv_purge_batch_size;
@ -552,8 +548,6 @@ extern ulong srv_fatal_semaphore_wait_threshold;
/** Buffer pool dump status frequence in percentages */
extern ulong srv_buf_dump_status_frequency;
#define srv_max_purge_threads 32
# ifdef UNIV_PFS_THREAD
extern mysql_pfs_key_t page_cleaner_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
of an externally stored column, or 0
@return remaining part of undo log record after reading these values */
byte*
trx_undo_rec_get_col_val(
const byte* ptr,
const byte** field,
ulint* len,
ulint* orig_len);
byte *trx_undo_rec_get_col_val(const byte *ptr, const byte **field,
uint32_t *len, uint32_t *orig_len);
/** Read virtual column value from undo log
@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,
and online log for virtual columns. So
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 */
const byte*
trx_undo_read_v_idx(
@ -283,7 +279,7 @@ trx_undo_read_v_idx(
const byte* ptr,
bool first_v_col,
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
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
should be incremented on the inc() calls round(k*N),
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>(
round(m_n_recs_processed / every_nth));
round(static_cast<double>(m_n_recs_processed) /
every_nth));
const ulint nth = static_cast<ulint>(
round(k * every_nth));
round(static_cast<double>(k) * every_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;
} else {
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);
}
}

View file

@ -632,7 +632,7 @@ lock_rec_has_to_wait(
bool for_locking,
/*!< in is called locking or releasing */
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
ORed to LOCK_GAP or LOCK_REC_NOT_GAP,
LOCK_INSERT_INTENTION */
@ -1136,7 +1136,7 @@ static
lock_t*
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
LOC_REC_NOT_GAP,
LOCK_INSERT_INTENTION */
@ -1313,7 +1313,7 @@ lock_rec_create_low(
lock_t* c_lock, /*!< conflicting lock */
que_thr_t* thr, /*!< thread owning trx */
#endif
ulint type_mode,
unsigned type_mode,
ulint space,
ulint page_no,
const page_t* page,
@ -1662,7 +1662,7 @@ lock_rec_enqueue_waiting(
#ifdef WITH_WSREP
lock_t* c_lock, /*!< conflicting lock */
#endif
ulint type_mode,
unsigned type_mode,
const buf_block_t* block,
ulint heap_no,
dict_index_t* index,
@ -1770,7 +1770,7 @@ static
void
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
and replaced by LOCK_REC */
const buf_block_t* block, /*!< in: buffer block containing
@ -1902,7 +1902,7 @@ lock_rec_lock(
if no wait is necessary: we
assume that the caller will
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_GAP or LOCK_REC_NOT_GAP */
const buf_block_t* block, /*!< in: buffer block containing
@ -2430,8 +2430,7 @@ lock_rec_inherit_to_gap(
|| lock_get_mode(lock) !=
(lock->trx->duplicates ? LOCK_S : LOCK_X))) {
lock_rec_add_to_queue(
LOCK_REC | LOCK_GAP
| ulint(lock_get_mode(lock)),
LOCK_REC | LOCK_GAP | lock_get_mode(lock),
heir_block, heir_heap_no, lock->index,
lock->trx, FALSE);
}
@ -2467,8 +2466,7 @@ lock_rec_inherit_to_gap_if_gap_lock(
|| !lock_rec_get_rec_not_gap(lock))) {
lock_rec_add_to_queue(
LOCK_REC | LOCK_GAP
| ulint(lock_get_mode(lock)),
LOCK_REC | LOCK_GAP | lock_get_mode(lock),
block, heir_heap_no, lock->index,
lock->trx, FALSE);
}
@ -2511,7 +2509,7 @@ lock_rec_move_low(
lock != NULL;
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);
@ -2744,7 +2742,7 @@ lock_move_rec_list_end(
lock = lock_rec_get_next_on_page(lock)) {
const rec_t* rec1 = rec;
const rec_t* rec2;
const ulint type_mode = lock->type_mode;
const auto type_mode = lock->type_mode;
if (comp) {
if (page_offset(rec1) == PAGE_NEW_INFIMUM) {
@ -2859,7 +2857,7 @@ lock_move_rec_list_start(
lock = lock_rec_get_next_on_page(lock)) {
const rec_t* rec1;
const rec_t* rec2;
const ulint type_mode = lock->type_mode;
const auto type_mode = lock->type_mode;
if (comp) {
rec1 = page_rec_get_next_low(
@ -2972,7 +2970,7 @@ lock_rtr_move_rec_list(
ulint moved = 0;
const rec_t* rec1;
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
reset the lock bits on the old */
@ -3453,7 +3451,7 @@ lock_table_create(
/*==============*/
dict_table_t* table, /*!< in/out: database table
in dictionary cache */
ulint type_mode,/*!< in: lock mode possibly ORed with
unsigned type_mode,/*!< in: lock mode possibly ORed with
LOCK_WAIT */
trx_t* trx /*!< in: trx */
#ifdef WITH_WSREP
@ -3703,7 +3701,7 @@ static
dberr_t
lock_table_enqueue_waiting(
/*=======================*/
ulint mode, /*!< in: lock mode this transaction is
unsigned mode, /*!< in: lock mode this transaction is
requesting */
dict_table_t* table, /*!< in/out: table */
que_thr_t* thr /*!< in: query thread */
@ -3740,7 +3738,7 @@ lock_table_enqueue_waiting(
#endif /* WITH_WSREP */
/* 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
, c_lock
#endif
@ -3834,7 +3832,7 @@ be granted immediately, the query thread is put to wait.
dberr_t
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 */
dict_table_t* table, /*!< in/out: database table
in dictionary cache */
@ -3899,14 +3897,14 @@ lock_table(
mode: this trx may have to wait */
if (wait_for != NULL) {
err = lock_table_enqueue_waiting(ulint(mode) | flags, table,
err = lock_table_enqueue_waiting(flags | mode, table,
thr
#ifdef WITH_WSREP
, wait_for
#endif
);
} 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);
@ -5295,7 +5293,7 @@ lock_rec_insert_check_and_lock(
had to wait for their insert. Both had waiting gap type lock requests
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 (
#ifdef WITH_WSREP
@ -5712,7 +5710,7 @@ lock_sec_rec_read_check_and_lock(
records: LOCK_S or LOCK_X; the
latter is possible in
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 */
que_thr_t* thr) /*!< in: query thread */
{
@ -5749,7 +5747,7 @@ lock_sec_rec_read_check_and_lock(
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);
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
latter is possible in
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 */
que_thr_t* thr) /*!< in: query thread */
{
@ -5814,7 +5812,7 @@ lock_clust_rec_read_check_and_lock(
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);
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
latter is possible in
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 */
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) 2018, 2019, MariaDB Corporation.
Copyright (c) 2018, 2020, MariaDB Corporation.
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
@ -153,7 +153,7 @@ bool
lock_prdt_has_to_wait(
/*==================*/
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
ORed to LOCK_PREDICATE or LOCK_PRDT_PAGE,
LOCK_INSERT_INTENTION */
@ -228,7 +228,7 @@ lock_t*
lock_prdt_has_lock(
/*===============*/
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
containing the record */
lock_prdt_t* prdt, /*!< in: The predicate to be
@ -285,7 +285,7 @@ static
lock_t*
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
LOCK_PRDT_PAGE, LOCK_INSERT_INTENTION */
const buf_block_t* block, /*!< in: buffer block containing
@ -385,7 +385,7 @@ static
lock_t*
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 */
lock_prdt_t* prdt, /*!< in: MBR with the lock */
const trx_t* trx) /*!< in: transaction */
@ -423,7 +423,7 @@ static
lock_t*
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
and replaced by LOCK_REC */
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 */
ulint space, /*!< in: space id */
ulint page_no, /*!< in: page number */
ulint type_mode) /*!< in: LOCK_PREDICATE or
unsigned type_mode) /*!< in: LOCK_PREDICATE or
LOCK_PRDT_PAGE */
{
lock_t* lock;
@ -797,7 +797,7 @@ lock_prdt_lock(
records: LOCK_S or LOCK_X; the
latter is possible in
SELECT FOR UPDATE */
ulint type_mode,
unsigned type_mode,
/*!< in: LOCK_PREDICATE or LOCK_PRDT_PAGE */
que_thr_t* thr) /*!< in: query thread
(can be NULL if BTR_NO_LOCKING_FLAG) */
@ -825,7 +825,7 @@ lock_prdt_lock(
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);
if (lock == NULL) {
@ -833,7 +833,7 @@ lock_prdt_lock(
#ifdef WITH_WSREP
NULL, NULL, /* FIXME: replicate SPATIAL INDEX locks */
#endif
ulint(mode) | type_mode, block, PRDT_HEAPNO,
prdt_mode, block, PRDT_HEAPNO,
index, trx, FALSE);
status = LOCK_REC_SUCCESS_CREATED;
@ -865,7 +865,7 @@ lock_prdt_lock(
NULL, /* FIXME: replicate
SPATIAL INDEX locks */
#endif
ulint(mode) | type_mode,
prdt_mode,
block, PRDT_HEAPNO,
index, thr, prdt);
} else {
@ -1012,7 +1012,7 @@ lock_prdt_rec_move(
lock != NULL;
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_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)) {
ut_ad(!"too many checkpoint pages");
ut_ad("too many checkpoint pages" == 0);
goto next_slot;
}
infos_used++;

View file

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

View file

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

View file

@ -1452,7 +1452,7 @@ inc_dir:
case REC_STATUS_INFIMUM:
break;
case REC_STATUS_SUPREMUM:
ut_ad(!"wrong status on cur->rec");
ut_ad("wrong status on cur->rec" == 0);
}
switch (rec_get_status(rec)) {
case REC_STATUS_NODE_PTR:
@ -1471,7 +1471,7 @@ inc_dir:
break;
case REC_STATUS_INFIMUM:
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);
#endif
@ -2671,7 +2671,7 @@ corrupted:
memcpy(buf, &prev_rec[-REC_N_NEW_EXTRA_BYTES - hdr_c], 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 */
h= (h & ((1U << 5) - 1)) << 3;
static_assert(REC_STATUS_ORDINARY == 0, "compatibility");

View file

@ -1120,7 +1120,8 @@ cmp_rec_rec(
no need to compare the child page number. */
n_fields = std::min(rec_offs_n_fields(offsets1),
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++) {
ulint mtype;

View file

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

View file

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

View file

@ -1392,7 +1392,7 @@ row_import::set_root_by_name() UNIV_NOTHROW
/* We've already checked that it exists. */
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;
index->page = cfg_index[i].m_page_no;
++i;
index->page = static_cast<uint32_t>(
cfg_index[i++].m_page_no);
}
}
@ -2445,7 +2444,7 @@ row_import_cfg_read_string(
break;
} else if (ch != 0) {
if (len < max_len) {
ptr[len++] = ch;
ptr[len++] = static_cast<byte>(ch);
} else {
break;
}
@ -2825,12 +2824,12 @@ row_import_read_columns(
col->len = mach_read_from_4(ptr);
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->mbminlen = mbminmaxlen % 5;
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);
col->ord_part = mach_read_from_4(ptr);

View file

@ -483,7 +483,7 @@ row_ins_cascade_calc_update_vec(
ulint i;
ulint j;
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;
ulint prefix_col;
@ -540,10 +540,9 @@ row_ins_cascade_calc_update_vec(
ufield = update->fields + n_fields_updated;
ufield->field_no
= dict_table_get_nth_col_pos(
table, dict_col_get_no(col),
&prefix_col);
ufield->field_no = dict_table_get_nth_col_pos(
table, dict_col_get_no(col),
&prefix_col);
ufield->orig_len = 0;
ufield->exp = NULL;
@ -1487,7 +1486,7 @@ static
dberr_t
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 */
const buf_block_t* block, /*!< in: buffer block of rec */
const rec_t* rec, /*!< in: record */
@ -1518,7 +1517,7 @@ static
dberr_t
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 */
const buf_block_t* block, /*!< in: buffer block of rec */
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);
break;
default:
ut_ad(!"wrong page type");
ut_ad("wrong page type" == 0);
}
#endif /* UNIV_DEBUG */
ut_ad(!rec_is_metadata(rec, *index));

View file

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

View file

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

View file

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

View file

@ -958,25 +958,17 @@ row_sel_get_clust_rec(
if (!node->read_view) {
/* Try to place a lock on the index record */
ulint lock_type;
trx_t* trx;
trx = thr_get_trx(thr);
trx_t* trx = thr_get_trx(thr);
/* At READ UNCOMMITTED or READ COMMITTED isolation level
we lock only the record, i.e., next-key locking is
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(
0, btr_pcur_get_block(&plan->clust_pcur),
clust_rec, index, offsets,
static_cast<lock_mode>(node->row_lock_mode),
lock_type,
node->row_lock_mode,
trx->isolation_level <= TRX_ISO_READ_COMMITTED
? LOCK_REC_NOT_GAP : LOCK_ORDINARY,
thr);
switch (err) {
@ -1069,8 +1061,8 @@ sel_set_rtr_rec_lock(
const rec_t* first_rec,/*!< in: record */
dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint mode, /*!< in: lock mode */
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
unsigned mode, /*!< in: lock mode */
unsigned type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOC_REC_NOT_GAP */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */
@ -1235,8 +1227,8 @@ sel_set_rec_lock(
const rec_t* rec, /*!< in: record */
dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint mode, /*!< in: lock mode */
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
unsigned mode, /*!< in: lock mode */
unsigned type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOC_REC_NOT_GAP */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */
@ -1727,7 +1719,7 @@ rec_loop:
if (!consistent_read) {
rec_t* next_rec = page_rec_get_next(rec);
ulint lock_type;
unsigned lock_type;
trx_t* trx;
trx = thr_get_trx(thr);
@ -1790,7 +1782,7 @@ skip_lock:
if (!consistent_read) {
/* Try to place a lock on the index record */
ulint lock_type;
unsigned lock_type;
trx_t* trx;
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(
0, btr_pcur_get_block(prebuilt->clust_pcur),
clust_rec, clust_index, *offsets,
static_cast<lock_mode>(prebuilt->select_lock_type),
prebuilt->select_lock_type,
LOCK_REC_NOT_GAP,
thr);
@ -4911,7 +4903,7 @@ wrong_offs:
is a non-delete marked record, then it is enough to lock its
existence with LOCK_REC_NOT_GAP. */
ulint lock_type;
unsigned lock_type;
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
/* 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) {
default:
ut_ad(!"wrong undo record type");
ut_ad("wrong undo record type" == 0);
goto close_table;
case TRX_UNDO_INSERT_METADATA:
case TRX_UNDO_INSERT_REC:
@ -536,7 +536,7 @@ row_undo_ins(
switch (node->rec_type) {
default:
ut_ad(!"wrong undo record type");
ut_ad("wrong undo record type" == 0);
/* fall through */
case TRX_UNDO_INSERT_REC:
/* 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_DELETED_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;
}
/* This must be an undo log record for a subsequent

View file

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

View file

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

View file

@ -88,7 +88,8 @@ srv_enter_innodb_with_tickets(
to enter InnoDB */
{
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 */
ulong srv_flushing_avg_loops;
/** innodb_purge_threads; the number of purge threads to use */
ulong srv_n_purge_threads;
/** innodb_purge_threads; the number of purge tasks to use */
uint srv_n_purge_threads;
/** innodb_purge_batch_size, in pages */
ulong srv_purge_batch_size;
@ -995,15 +995,15 @@ srv_printf_innodb_monitor(
fprintf(file,
"%.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,
(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);
btr_cur_n_sea_old = btr_cur_n_sea;
#else /* BTR_CUR_HASH_ADAPT */
fprintf(file,
"%.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);
#endif /* BTR_CUR_HASH_ADAPT */
btr_cur_n_non_sea_old = btr_cur_n_non_sea;
@ -1062,13 +1062,17 @@ srv_printf_innodb_monitor(
fprintf(file,
"%.2f inserts/s, %.2f updates/s,"
" %.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,
((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,
((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,
((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);
fprintf(file,
"Number of system rows inserted " ULINTPF
@ -1081,14 +1085,18 @@ srv_printf_innodb_monitor(
fprintf(file,
"%.2f inserts/s, %.2f updates/s,"
" %.2f deletes/s, %.2f reads/s\n",
((ulint) srv_stats.n_system_rows_inserted
- srv_n_system_rows_inserted_old) / time_elapsed,
((ulint) srv_stats.n_system_rows_updated
- srv_n_system_rows_updated_old) / time_elapsed,
((ulint) srv_stats.n_system_rows_deleted
- srv_n_system_rows_deleted_old) / time_elapsed,
((ulint) srv_stats.n_system_rows_read
- srv_n_system_rows_read_old) / time_elapsed);
static_cast<double>(srv_stats.n_system_rows_inserted
- srv_n_system_rows_inserted_old)
/ time_elapsed,
static_cast<double>(srv_stats.n_system_rows_updated
- srv_n_system_rows_updated_old)
/ time_elapsed,
static_cast<double>(srv_stats.n_system_rows_deleted
- 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_updated_old = srv_stats.n_rows_updated;
srv_n_rows_deleted_old = srv_stats.n_rows_deleted;

View file

@ -1556,7 +1556,7 @@ file_checked:
break;
case SRV_OPERATION_RESTORE_DELTA:
case SRV_OPERATION_BACKUP:
ut_ad(!"wrong mariabackup mode");
ut_ad("wrong mariabackup mode" == 0);
}
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 */
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;
double longest_diff = 0;
ulint i;

View file

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2020, MariaDB Corporation.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@ -143,15 +144,18 @@ sync_print_wait_info(FILE* file)
fprintf(file,
"Spin rounds per wait: %.2f RW-shared,"
" %.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 : 1LL),
(double) rw_lock_stats.rw_x_spin_round_count /
(rw_lock_stats.rw_x_spin_wait_count
? rw_lock_stats.rw_x_spin_wait_count : 1LL),
(double) rw_lock_stats.rw_sx_spin_round_count /
(rw_lock_stats.rw_sx_spin_wait_count
? rw_lock_stats.rw_sx_spin_wait_count : 1LL));
rw_lock_stats.rw_s_spin_wait_count
? static_cast<double>(rw_lock_stats.rw_s_spin_round_count) /
static_cast<double>(rw_lock_stats.rw_s_spin_wait_count)
: static_cast<double>(rw_lock_stats.rw_s_spin_round_count),
rw_lock_stats.rw_x_spin_wait_count
? static_cast<double>(rw_lock_stats.rw_x_spin_round_count) /
static_cast<double>(rw_lock_stats.rw_x_spin_wait_count)
: static_cast<double>(rw_lock_stats.rw_x_spin_round_count),
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;
break;
default:
ut_ad(!"unknown lock mode");
ut_ad("unknown lock mode" == 0);
row->lock_mode = 0;
}

View file

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

View file

@ -174,7 +174,7 @@ trx_undo_log_v_idx(
indexed, and return its position
@param[in] table the table
@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
@return remaining part of undo log record after reading these values */
static
@ -182,12 +182,12 @@ const byte*
trx_undo_read_v_idx_low(
const dict_table_t* table,
const byte* ptr,
ulint* col_pos)
uint32_t* col_pos)
{
ulint len = mach_read_from_2(ptr);
const byte* old_ptr = ptr;
*col_pos = ULINT_UNDEFINED;
*col_pos = FIL_NULL;
ptr += 2;
@ -235,7 +235,7 @@ still indexed, and output its position
check to see if this is undo log. When
first_v_col is true, is_undo_log is output,
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 */
const byte*
trx_undo_read_v_idx(
@ -243,7 +243,7 @@ trx_undo_read_v_idx(
const byte* ptr,
bool first_v_col,
bool* is_undo_log,
ulint* field_no)
uint32_t* field_no)
{
/* Version marker only put on the first virtual column */
if (first_v_col) {
@ -493,8 +493,8 @@ byte*
trx_undo_rec_get_col_val(
const byte* ptr,
const byte** field,
ulint* len,
ulint* orig_len)
uint32_t* len,
uint32_t* orig_len)
{
*len = mach_read_next_compressed(&ptr);
*orig_len = 0;
@ -567,8 +567,7 @@ trx_undo_rec_get_row_ref(
for (i = 0; i < ref_len; i++) {
const byte* field;
ulint len;
ulint orig_len;
uint32_t len, orig_len;
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++) {
const byte* field;
ulint len;
ulint orig_len;
uint32_t 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 */
for (ulint i = 0; i < n_fields; i++) {
const byte* field;
ulint len;
ulint orig_len;
const byte* field;
uint32_t len, orig_len;
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);
@ -1503,7 +1500,7 @@ trx_undo_update_rec_get_update(
&field_no);
first_v_col = false;
/* 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 */
upd_field->field_no = REC_MAX_N_FIELDS;
@ -1570,7 +1567,8 @@ trx_undo_update_rec_get_update(
field_no),
&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) {
upd_field_set_field_no(upd_field, field_no, index);
} else {
@ -1712,15 +1710,13 @@ trx_undo_rec_get_partial_row(
while (ptr != end_ptr) {
dfield_t* dfield;
const byte* field;
ulint field_no;
uint32_t field_no;
const dict_col_t* col;
ulint len;
ulint orig_len;
bool is_virtual;
uint32_t len, orig_len;
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) {
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);
/* This column could be dropped or no longer indexed */
if (field_no == ULINT_UNDEFINED) {
if (field_no == FIL_NULL) {
ut_ad(is_virtual);
continue;
}
@ -2484,17 +2480,14 @@ trx_undo_read_v_cols(
end_ptr = ptr + mach_read_from_2(ptr);
ptr += 2;
while (ptr < end_ptr) {
dfield_t* dfield;
const byte* field;
ulint field_no;
ulint len;
ulint orig_len;
bool is_virtual;
dfield_t* dfield;
const byte* field;
uint32_t field_no, len, orig_len;
field_no = mach_read_next_compressed(
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) {
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.
This needs to put after trx_undo_rec_get_col_val() so the
undo ptr advances */
if (field_no == ULINT_UNDEFINED) {
if (field_no == FIL_NULL) {
ut_ad(is_virtual);
continue;
}