mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
Fix some integer type mismatch.
Use uint32_t for the encryption key_id. When filling unsigned integer values into INFORMATION_SCHEMA tables, use the method Field::store(longlong, bool unsigned) instead of using Field::store(double). Fix also some miscellanous type mismatch related to ulint (size_t).
This commit is contained in:
parent
2e41259bfc
commit
021d636551
20 changed files with 59 additions and 59 deletions
|
@ -713,7 +713,7 @@ btr_page_free_low(
|
|||
* pages should be possible
|
||||
*/
|
||||
uint cnt = 0;
|
||||
uint bytes = 0;
|
||||
ulint bytes = 0;
|
||||
page_t* page = buf_block_get_frame(block);
|
||||
mem_heap_t* heap = NULL;
|
||||
ulint* offsets = NULL;
|
||||
|
@ -731,7 +731,7 @@ btr_page_free_low(
|
|||
#ifdef UNIV_DEBUG_SCRUBBING
|
||||
fprintf(stderr,
|
||||
"btr_page_free_low: scrub %lu/%lu - "
|
||||
"%u records %u bytes\n",
|
||||
"%u records " ULINTPF " bytes\n",
|
||||
buf_block_get_space(block),
|
||||
buf_block_get_page_no(block),
|
||||
cnt, bytes);
|
||||
|
|
|
@ -1246,7 +1246,7 @@ tab_create_graph_create(
|
|||
structure */
|
||||
mem_heap_t* heap, /*!< in: heap where created */
|
||||
fil_encryption_t mode, /*!< in: encryption mode */
|
||||
ulint key_id) /*!< in: encryption key_id */
|
||||
uint32_t key_id) /*!< in: encryption key_id */
|
||||
{
|
||||
tab_node_t* node;
|
||||
|
||||
|
@ -2054,7 +2054,7 @@ dict_foreign_def_get_fields(
|
|||
trx_t* trx, /*!< in: trx */
|
||||
char** field, /*!< out: foreign column */
|
||||
char** field2, /*!< out: referenced column */
|
||||
int col_no) /*!< in: column number */
|
||||
ulint col_no) /*!< in: column number */
|
||||
{
|
||||
char* bufend;
|
||||
char* fieldbuf = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1);
|
||||
|
|
|
@ -6760,7 +6760,7 @@ dict_fs2utf8(
|
|||
db[db_len] = '\0';
|
||||
|
||||
strconvert(
|
||||
&my_charset_filename, db, db_len, system_charset_info,
|
||||
&my_charset_filename, db, uint(db_len), system_charset_info,
|
||||
db_utf8, uint(db_utf8_size), &errors);
|
||||
|
||||
/* convert each # to @0023 in table name and store the result in buf */
|
||||
|
|
|
@ -277,8 +277,8 @@ fil_space_read_crypt_data(const page_size_t& page_size, const byte* page)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ulint type = mach_read_from_1(page + offset + MAGIC_SZ + 0);
|
||||
ulint iv_length = mach_read_from_1(page + offset + MAGIC_SZ + 1);
|
||||
uint8_t type = mach_read_from_1(page + offset + MAGIC_SZ + 0);
|
||||
uint8_t iv_length = mach_read_from_1(page + offset + MAGIC_SZ + 1);
|
||||
fil_space_crypt_t* crypt_data;
|
||||
|
||||
if (!(type == CRYPT_SCHEME_UNENCRYPTED ||
|
||||
|
@ -537,14 +537,14 @@ fil_encrypt_buf(
|
|||
const page_size_t& page_size,
|
||||
byte* dst_frame)
|
||||
{
|
||||
ulint size = page_size.physical();
|
||||
uint size = uint(page_size.physical());
|
||||
uint key_version = fil_crypt_get_latest_key_version(crypt_data);
|
||||
|
||||
ut_a(key_version != ENCRYPTION_KEY_VERSION_INVALID);
|
||||
|
||||
ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
|
||||
ibool page_compressed = (orig_page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
|
||||
ulint header_len = FIL_PAGE_DATA;
|
||||
uint header_len = FIL_PAGE_DATA;
|
||||
|
||||
if (page_compressed) {
|
||||
header_len += (FIL_PAGE_COMPRESSED_SIZE + FIL_PAGE_COMPRESSION_METHOD_SIZE);
|
||||
|
@ -557,8 +557,8 @@ fil_encrypt_buf(
|
|||
mach_write_to_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, key_version);
|
||||
|
||||
/* Calculate the start offset in a page */
|
||||
ulint unencrypted_bytes = header_len + FIL_PAGE_DATA_END;
|
||||
ulint srclen = size - unencrypted_bytes;
|
||||
uint unencrypted_bytes = header_len + FIL_PAGE_DATA_END;
|
||||
uint srclen = size - unencrypted_bytes;
|
||||
const byte* src = src_frame + header_len;
|
||||
byte* dst = dst_frame + header_len;
|
||||
uint32 dstlen = 0;
|
||||
|
@ -719,8 +719,8 @@ fil_space_decrypt(
|
|||
ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
|
||||
uint key_version = mach_read_from_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
|
||||
bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
|
||||
ulint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET);
|
||||
ulint space = mach_read_from_4(src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
||||
uint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET);
|
||||
uint space = mach_read_from_4(src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
||||
ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN);
|
||||
|
||||
*err = DB_SUCCESS;
|
||||
|
@ -732,7 +732,7 @@ fil_space_decrypt(
|
|||
ut_a(crypt_data != NULL && crypt_data->is_encrypted());
|
||||
|
||||
/* read space & lsn */
|
||||
ulint header_len = FIL_PAGE_DATA;
|
||||
uint header_len = FIL_PAGE_DATA;
|
||||
|
||||
if (page_compressed) {
|
||||
header_len += (FIL_PAGE_COMPRESSED_SIZE + FIL_PAGE_COMPRESSION_METHOD_SIZE);
|
||||
|
@ -745,7 +745,8 @@ fil_space_decrypt(
|
|||
const byte* src = src_frame + header_len;
|
||||
byte* dst = tmp_frame + header_len;
|
||||
uint32 dstlen = 0;
|
||||
ulint srclen = page_size.physical() - (header_len + FIL_PAGE_DATA_END);
|
||||
uint srclen = uint(page_size.physical())
|
||||
- header_len - FIL_PAGE_DATA_END;
|
||||
|
||||
if (page_compressed) {
|
||||
srclen = mach_read_from_2(src_frame + FIL_PAGE_DATA);
|
||||
|
@ -833,12 +834,12 @@ Calculate post encryption checksum
|
|||
@return page checksum or BUF_NO_CHECKSUM_MAGIC
|
||||
not needed. */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
uint32_t
|
||||
fil_crypt_calculate_checksum(
|
||||
const page_size_t& page_size,
|
||||
const byte* dst_frame)
|
||||
{
|
||||
ib_uint32_t checksum = 0;
|
||||
uint32_t checksum = 0;
|
||||
srv_checksum_algorithm_t algorithm =
|
||||
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
|
||||
|
||||
|
@ -1084,7 +1085,7 @@ struct rotate_thread_t {
|
|||
|
||||
uint estimated_max_iops; /*!< estimation of max iops */
|
||||
uint allocated_iops; /*!< allocated iops */
|
||||
uint cnt_waited; /*!< #times waited during this slot */
|
||||
ulint cnt_waited; /*!< #times waited during this slot */
|
||||
uintmax_t sum_waited_us; /*!< wait time during this slot */
|
||||
|
||||
fil_crypt_stat_t crypt_stat; // statistics
|
||||
|
@ -1602,7 +1603,7 @@ fil_crypt_get_page_throttle_func(
|
|||
mtr_t* mtr,
|
||||
ulint* sleeptime_ms,
|
||||
const char* file,
|
||||
ulint line)
|
||||
unsigned line)
|
||||
{
|
||||
fil_space_t* space = state->space;
|
||||
const page_size_t page_size = page_size_t(space->flags);
|
||||
|
@ -2334,7 +2335,7 @@ fil_space_crypt_close_tablespace(
|
|||
mutex_enter(&crypt_data->mutex);
|
||||
mutex_exit(&fil_crypt_threads_mutex);
|
||||
|
||||
uint cnt = crypt_data->rotate_state.active_threads;
|
||||
ulint cnt = crypt_data->rotate_state.active_threads;
|
||||
bool flushing = crypt_data->rotate_state.flushing;
|
||||
|
||||
while (cnt > 0 || flushing) {
|
||||
|
|
|
@ -3794,7 +3794,7 @@ fil_ibd_create(
|
|||
ulint flags,
|
||||
ulint size,
|
||||
fil_encryption_t mode,
|
||||
ulint key_id)
|
||||
uint32_t key_id)
|
||||
{
|
||||
os_file_t file;
|
||||
dberr_t err;
|
||||
|
@ -6960,9 +6960,10 @@ fil_space_get_block_size(const fil_space_t* space, unsigned offset)
|
|||
node = UT_LIST_GET_NEXT(chain, node)) {
|
||||
block_size = node->block_size;
|
||||
if (node->size > offset) {
|
||||
ut_ad(node->size <= 0xFFFFFFFFU);
|
||||
break;
|
||||
}
|
||||
offset -= node->size;
|
||||
offset -= static_cast<unsigned>(node->size);
|
||||
}
|
||||
|
||||
/* Currently supporting block size up to 4K,
|
||||
|
|
|
@ -11974,8 +11974,7 @@ err_col:
|
|||
err = row_create_table_for_mysql(
|
||||
table, m_trx, false,
|
||||
(fil_encryption_t)options->encryption,
|
||||
(ulint)options->encryption_key_id);
|
||||
|
||||
options->encryption_key_id);
|
||||
}
|
||||
|
||||
DBUG_EXECUTE_IF("ib_crash_during_create_for_encryption",
|
||||
|
|
|
@ -4557,7 +4557,7 @@ prepare_inplace_alter_table_dict(
|
|||
dtuple_t* add_cols;
|
||||
ulint space_id = 0;
|
||||
ulint z = 0;
|
||||
ulint key_id = FIL_DEFAULT_ENCRYPTION_KEY;
|
||||
uint32_t key_id = FIL_DEFAULT_ENCRYPTION_KEY;
|
||||
fil_encryption_t mode = FIL_ENCRYPTION_DEFAULT;
|
||||
|
||||
fil_space_t* space = fil_space_acquire(ctx->prebuilt->table->space);
|
||||
|
|
|
@ -7117,11 +7117,11 @@ i_s_dict_fill_sys_virtual(
|
|||
|
||||
fields = table_to_fill->field;
|
||||
|
||||
OK(fields[SYS_VIRTUAL_TABLE_ID]->store((longlong) table_id, TRUE));
|
||||
OK(fields[SYS_VIRTUAL_TABLE_ID]->store(table_id, true));
|
||||
|
||||
OK(fields[SYS_VIRTUAL_POS]->store(pos));
|
||||
OK(fields[SYS_VIRTUAL_POS]->store(pos, true));
|
||||
|
||||
OK(fields[SYS_VIRTUAL_BASE_POS]->store(base_pos));
|
||||
OK(fields[SYS_VIRTUAL_BASE_POS]->store(base_pos, true));
|
||||
|
||||
OK(schema_table_store_record(thd, table_to_fill));
|
||||
|
||||
|
@ -8601,31 +8601,31 @@ i_s_dict_fill_tablespaces_encryption(
|
|||
|
||||
fil_space_crypt_get_status(space, &status);
|
||||
|
||||
OK(fields[TABLESPACES_ENCRYPTION_SPACE]->store(space->id));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_SPACE]->store(space->id, true));
|
||||
|
||||
OK(field_store_string(fields[TABLESPACES_ENCRYPTION_NAME],
|
||||
space->name));
|
||||
|
||||
OK(fields[TABLESPACES_ENCRYPTION_ENCRYPTION_SCHEME]->store(
|
||||
status.scheme));
|
||||
status.scheme, true));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_KEYSERVER_REQUESTS]->store(
|
||||
status.keyserver_requests));
|
||||
status.keyserver_requests, true));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_MIN_KEY_VERSION]->store(
|
||||
status.min_key_version));
|
||||
status.min_key_version, true));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_VERSION]->store(
|
||||
status.current_key_version));
|
||||
status.current_key_version, true));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store(
|
||||
status.key_id));
|
||||
status.key_id, true));
|
||||
OK(fields[TABLESPACES_ENCRYPTION_ROTATING_OR_FLUSHING]->store(
|
||||
(status.rotating || status.flushing) ? 1 : 0));
|
||||
status.rotating || status.flushing, true));
|
||||
|
||||
if (status.rotating) {
|
||||
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull();
|
||||
OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->store(
|
||||
status.rotate_next_page_number));
|
||||
status.rotate_next_page_number, true));
|
||||
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_MAX_PAGE_NUMBER]->set_notnull();
|
||||
OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_MAX_PAGE_NUMBER]->store(
|
||||
status.rotate_max_page_number));
|
||||
status.rotate_max_page_number, true));
|
||||
} else {
|
||||
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]
|
||||
->set_null();
|
||||
|
@ -8910,13 +8910,13 @@ i_s_dict_fill_tablespaces_scrubbing(
|
|||
|
||||
fil_space_get_scrub_status(space, &status);
|
||||
|
||||
OK(fields[TABLESPACES_SCRUBBING_SPACE]->store(space->id));
|
||||
OK(fields[TABLESPACES_SCRUBBING_SPACE]->store(space->id, true));
|
||||
|
||||
OK(field_store_string(fields[TABLESPACES_SCRUBBING_NAME],
|
||||
space->name));
|
||||
|
||||
OK(fields[TABLESPACES_SCRUBBING_COMPRESSED]->store(
|
||||
status.compressed ? 1 : 0));
|
||||
status.compressed ? 1 : 0, true));
|
||||
|
||||
if (status.last_scrub_completed == 0) {
|
||||
fields[TABLESPACES_SCRUBBING_LAST_SCRUB_COMPLETED]->set_null();
|
||||
|
@ -8943,11 +8943,11 @@ i_s_dict_fill_tablespaces_scrubbing(
|
|||
fields[TABLESPACES_SCRUBBING_CURRENT_SCRUB_STARTED],
|
||||
status.current_scrub_started));
|
||||
OK(fields[TABLESPACES_SCRUBBING_CURRENT_SCRUB_ACTIVE_THREADS]
|
||||
->store(status.current_scrub_active_threads));
|
||||
->store(status.current_scrub_active_threads, true));
|
||||
OK(fields[TABLESPACES_SCRUBBING_CURRENT_SCRUB_PAGE_NUMBER]
|
||||
->store(status.current_scrub_page_number));
|
||||
->store(status.current_scrub_page_number, true));
|
||||
OK(fields[TABLESPACES_SCRUBBING_CURRENT_SCRUB_MAX_PAGE_NUMBER]
|
||||
->store(status.current_scrub_max_page_number));
|
||||
->store(status.current_scrub_max_page_number, true));
|
||||
} else {
|
||||
for (uint i = 0; i < array_elements(field_numbers); i++) {
|
||||
fields[field_numbers[i]]->set_null();
|
||||
|
|
|
@ -2829,8 +2829,7 @@ ibuf_get_volume_buffered_hash(
|
|||
fold = ut_fold_binary(data, len);
|
||||
|
||||
hash += (fold / (CHAR_BIT * sizeof *hash)) % size;
|
||||
bitmask = static_cast<ulint>(
|
||||
1 << (fold % (CHAR_BIT * sizeof(*hash))));
|
||||
bitmask = static_cast<ulint>(1) << (fold % (CHAR_BIT * sizeof(*hash)));
|
||||
|
||||
if (*hash & bitmask) {
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ tab_create_graph_create(
|
|||
a memory data structure */
|
||||
mem_heap_t* heap, /*!< in: heap where created */
|
||||
fil_encryption_t mode, /*!< in: encryption mode */
|
||||
ulint key_id); /*!< in: encryption key_id */
|
||||
uint32_t key_id); /*!< in: encryption key_id */
|
||||
|
||||
/** Creates an index create graph.
|
||||
@param[in] index index to create, built as a memory data structure
|
||||
|
@ -305,7 +305,7 @@ struct tab_node_t{
|
|||
/* Local storage for this graph node */
|
||||
ulint state; /*!< node execution state */
|
||||
ulint col_no; /*!< next column definition to insert */
|
||||
ulint key_id; /*!< encryption key_id */
|
||||
uint key_id; /*!< encryption key_id */
|
||||
fil_encryption_t mode; /*!< encryption mode */
|
||||
ulint base_col_no; /*!< next base column to insert */
|
||||
mem_heap_t* heap; /*!< memory heap used as auxiliary
|
||||
|
|
|
@ -206,7 +206,7 @@ struct fil_space_crypt_status_t {
|
|||
uint min_key_version; /*!< min key version */
|
||||
uint current_key_version;/*!< current key version */
|
||||
uint keyserver_requests;/*!< no of key requests to key server */
|
||||
ulint key_id; /*!< current key_id */
|
||||
uint key_id; /*!< current key_id */
|
||||
bool rotating; /*!< is key rotation ongoing */
|
||||
bool flushing; /*!< is flush at end of rotation ongoing */
|
||||
ulint rotate_next_page_number; /*!< next page if key rotating */
|
||||
|
@ -385,7 +385,7 @@ Calculate post encryption checksum
|
|||
@return page checksum or BUF_NO_CHECKSUM_MAGIC
|
||||
not needed. */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
uint32_t
|
||||
fil_crypt_calculate_checksum(
|
||||
const page_size_t& page_size,
|
||||
const byte* dst_frame)
|
||||
|
|
|
@ -1063,7 +1063,7 @@ fil_ibd_create(
|
|||
ulint flags,
|
||||
ulint size,
|
||||
fil_encryption_t mode,
|
||||
ulint key_id)
|
||||
uint32_t key_id)
|
||||
MY_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
/** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations.
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
|
||||
/** Get the tablespace encryption key_id
|
||||
@return m_key_id tablespace encryption key_id */
|
||||
ulint key_id() const
|
||||
uint32_t key_id() const
|
||||
{
|
||||
return (m_key_id);
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ private:
|
|||
|
||||
/** Encryption mode and key_id */
|
||||
fil_encryption_t m_mode;
|
||||
ulint m_key_id;
|
||||
uint32_t m_key_id;
|
||||
|
||||
protected:
|
||||
/** Ignore server read only configuration for this tablespace. */
|
||||
|
|
|
@ -365,7 +365,7 @@ row_create_table_for_mysql(
|
|||
trx_t* trx, /*!< in/out: transaction */
|
||||
bool commit, /*!< in: if true, commit the transaction */
|
||||
fil_encryption_t mode, /*!< in: encryption mode */
|
||||
ulint key_id) /*!< in: encryption key_id */
|
||||
uint32_t key_id) /*!< in: encryption key_id */
|
||||
MY_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
/*********************************************************************//**
|
||||
|
|
|
@ -359,7 +359,7 @@ private:
|
|||
|
||||
/** Encryption information of the table */
|
||||
fil_encryption_t m_encryption;
|
||||
uint m_key_id;
|
||||
uint32_t m_key_id;
|
||||
|
||||
/** Vector of tables to truncate. */
|
||||
typedef std::vector<truncate_t*, ut_allocator<truncate_t*> >
|
||||
|
|
|
@ -2653,7 +2653,7 @@ lock_rec_has_to_wait_in_queue(
|
|||
heap_no = lock_rec_find_set_bit(wait_lock);
|
||||
|
||||
bit_offset = heap_no / 8;
|
||||
bit_mask = static_cast<ulint>(1 << (heap_no % 8));
|
||||
bit_mask = static_cast<ulint>(1) << (heap_no % 8);
|
||||
|
||||
hash = lock_hash_get(wait_lock->type_mode);
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ public:
|
|||
void print(FILE* file);
|
||||
|
||||
/** @return the number of slots per segment */
|
||||
unsigned slots_per_segment() const
|
||||
ulint slots_per_segment() const
|
||||
MY_ATTRIBUTE((warn_unused_result))
|
||||
{
|
||||
return(m_slots.size() / m_n_segments);
|
||||
|
@ -5778,7 +5778,7 @@ AIO::init_linux_native_aio()
|
|||
}
|
||||
|
||||
io_context** ctx = m_aio_ctx;
|
||||
unsigned max_events = slots_per_segment();
|
||||
ulint max_events = slots_per_segment();
|
||||
|
||||
for (ulint i = 0; i < m_n_segments; ++i, ++ctx) {
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ os_mem_free_large(
|
|||
<< ") failed; Windows error " << GetLastError();
|
||||
} else {
|
||||
my_atomic_addlint(
|
||||
&os_total_large_mem_allocated, -size);
|
||||
&os_total_large_mem_allocated, -lint(size));
|
||||
UNIV_MEM_FREE(ptr, size);
|
||||
}
|
||||
#elif !defined OS_MAP_ANON
|
||||
|
|
|
@ -4641,7 +4641,7 @@ row_merge_build_indexes(
|
|||
|
||||
double total_static_cost = 0;
|
||||
double total_dynamic_cost = 0;
|
||||
uint total_index_blocks = 0;
|
||||
ulint total_index_blocks = 0;
|
||||
double pct_cost=0;
|
||||
double pct_progress=0;
|
||||
|
||||
|
|
|
@ -2448,7 +2448,7 @@ row_create_table_for_mysql(
|
|||
trx_t* trx, /*!< in/out: transaction */
|
||||
bool commit, /*!< in: if true, commit the transaction */
|
||||
fil_encryption_t mode, /*!< in: encryption mode */
|
||||
ulint key_id) /*!< in: encryption key_id */
|
||||
uint32_t key_id) /*!< in: encryption key_id */
|
||||
{
|
||||
tab_node_t* node;
|
||||
mem_heap_t* heap;
|
||||
|
|
Loading…
Add table
Reference in a new issue