diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-15 16:28:19 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-15 17:06:17 +0300 |
commit | 9028cc6b865222cae8c396b4ec3e317c8ee068d1 (patch) | |
tree | 2aecbbca53dda9b58c605bb371908fa82bc8057f | |
parent | 61161d51d724a7fc7f99af56b7c00dd7e86c023f (diff) | |
download | mariadb-git-9028cc6b865222cae8c396b4ec3e317c8ee068d1.tar.gz |
Cleanup: Make InnoDB page numbers uint32_t
InnoDB stores a 32-bit page number in page headers and in some
data structures, such as FIL_ADDR (consisting of a 32-bit page number
and a 16-bit byte offset within a page). For better compile-time
error detection and to reduce the memory footprint in some data
structures, let us use a uint32_t for the page number, instead
of ulint (size_t) which can be 64 bits.
46 files changed, 443 insertions, 606 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 3da6239b6f8..1d98f89894a 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3099,7 +3099,7 @@ xb_load_single_table_tablespace( ut_a(space != NULL); - space->add(file->filepath(), OS_FILE_CLOSED, ulint(n_pages), + space->add(file->filepath(), OS_FILE_CLOSED, uint32_t(n_pages), false, false); /* by opening the tablespace we forcing node and space objects in the cache to be populated with fields from space header */ @@ -4901,7 +4901,7 @@ xtrabackup_apply_delta( space->chain); bool fail = !strcmp(n->name, dst_path) && !fil_space_extend( - space, (ulint)n_pages); + space, uint32_t(n_pages)); if (fail) goto error; } } diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 0a558e77923..ea9f47d8f3a 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -9,15 +9,6 @@ VARIABLE_COMMENT Number of InnoDB Adaptive Hash Index Partitions (default 8) NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -73,7 +73,7 @@ - SESSION_VALUE NULL - DEFAULT_VALUE 64 - VARIABLE_SCOPE GLOBAL --VARIABLE_TYPE BIGINT UNSIGNED -+VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Data file autoextend increment in megabytes - NUMERIC_MIN_VALUE 1 - NUMERIC_MAX_VALUE 1000 @@ -85,7 +85,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 @@ -94,15 +85,6 @@ VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -793,7 +793,7 @@ - SESSION_VALUE NULL - DEFAULT_VALUE 0 - VARIABLE_SCOPE GLOBAL --VARIABLE_TYPE BIGINT UNSIGNED -+VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Make the first page of the given tablespace dirty. - NUMERIC_MIN_VALUE 0 - NUMERIC_MAX_VALUE 4294967295 @@ -805,7 +805,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 @@ -398,15 +380,6 @@ VARIABLE_COMMENT Number of background read I/O threads in InnoDB. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 64 -@@ -1657,7 +1657,7 @@ - SESSION_VALUE NULL - DEFAULT_VALUE 0 - VARIABLE_SCOPE GLOBAL --VARIABLE_TYPE BIGINT UNSIGNED -+VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT An InnoDB page number. - NUMERIC_MIN_VALUE 0 - NUMERIC_MAX_VALUE 4294967295 @@ -1705,7 +1705,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1048576 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 767d31c033e..5227c08052e 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -73,7 +73,7 @@ VARIABLE_NAME INNODB_AUTOEXTEND_INCREMENT SESSION_VALUE NULL DEFAULT_VALUE 64 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Data file autoextend increment in megabytes NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1000 @@ -793,7 +793,7 @@ VARIABLE_NAME INNODB_FIL_MAKE_PAGE_DIRTY_DEBUG SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Make the first page of the given tablespace dirty. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 @@ -1657,7 +1657,7 @@ VARIABLE_NAME INNODB_SAVED_PAGE_NUMBER_DEBUG SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT An InnoDB page number. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index e292815d00e..e7e70f76790 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -55,7 +55,7 @@ bool btr_can_merge_with_page( /*====================*/ btr_cur_t* cursor, /*!< in: cursor on the page to merge */ - ulint page_no, /*!< in: a sibling page */ + uint32_t page_no, /*!< in: a sibling page */ buf_block_t** merge_block, /*!< out: the merge block */ mtr_t* mtr); /*!< in: mini-transaction */ @@ -511,7 +511,7 @@ buf_block_t* btr_page_alloc_low( /*===============*/ dict_index_t* index, /*!< in: index */ - ulint hint_page_no, /*!< in: hint of a good page */ + uint32_t hint_page_no, /*!< in: hint of a good page */ byte file_direction, /*!< in: direction where a possible page split is made */ ulint level, /*!< in: level where the page is placed @@ -548,7 +548,7 @@ buf_block_t* btr_page_alloc( /*===========*/ dict_index_t* index, /*!< in: index */ - ulint hint_page_no, /*!< in: hint of a good page */ + uint32_t hint_page_no, /*!< in: hint of a good page */ byte file_direction, /*!< in: direction where a possible page split is made */ ulint level, /*!< in: level where the page is placed @@ -2801,7 +2801,7 @@ func_start: tuple to be inserted should be the first record on the upper half-page */ bool insert_left = false; - ulint hint_page_no = block->page.id().page_no() + 1; + uint32_t hint_page_no = block->page.id().page_no() + 1; byte direction = FSP_UP; if (tuple && n_iterations > 0) { @@ -3386,8 +3386,6 @@ btr_compress( mtr_t* mtr) /*!< in/out: mini-transaction */ { dict_index_t* index; - ulint left_page_no; - ulint right_page_no; buf_block_t* merge_block; page_t* merge_page = NULL; page_zip_des_t* merge_page_zip; @@ -3416,8 +3414,8 @@ btr_compress( MONITOR_INC(MONITOR_INDEX_MERGE_ATTEMPTS); - left_page_no = btr_page_get_prev(page); - right_page_no = btr_page_get_next(page); + const uint32_t left_page_no = btr_page_get_prev(page); + const uint32_t right_page_no = btr_page_get_next(page); #ifdef UNIV_DEBUG if (!page_is_leaf(page) && left_page_no == FIL_NULL) { @@ -3989,8 +3987,6 @@ btr_discard_page( mtr_t* mtr) /*!< in: mtr */ { dict_index_t* index; - ulint left_page_no; - ulint right_page_no; buf_block_t* merge_block; buf_block_t* block; btr_cur_t parent_cursor; @@ -4014,8 +4010,8 @@ btr_discard_page( /* Decide the page which will inherit the locks */ - left_page_no = btr_page_get_prev(block->frame); - right_page_no = btr_page_get_next(block->frame); + const uint32_t left_page_no = btr_page_get_prev(block->frame); + const uint32_t right_page_no = btr_page_get_next(block->frame); ut_d(bool parent_is_different = false); if (left_page_no != FIL_NULL) { @@ -4598,8 +4594,6 @@ btr_validate_level( btr_cur_t node_cur; btr_cur_t right_node_cur; rec_t* rec; - ulint right_page_no; - ulint left_page_no; page_cur_t cursor; dtuple_t* node_ptr_tuple; bool ret = true; @@ -4612,8 +4606,8 @@ btr_validate_level( #endif /* UNIV_ZIP_DEBUG */ ulint savepoint = 0; ulint savepoint2 = 0; - ulint parent_page_no = FIL_NULL; - ulint parent_right_page_no = FIL_NULL; + uint32_t parent_page_no = FIL_NULL; + uint32_t parent_right_page_no = FIL_NULL; bool rightmost_child = false; mtr.start(); @@ -4669,7 +4663,7 @@ btr_validate_level( does not use such scan for any of its DML or query operations */ if (dict_index_is_spatial(index)) { - left_page_no = btr_page_get_prev(page); + uint32_t left_page_no = btr_page_get_prev(page); while (left_page_no != FIL_NULL) { /* To obey latch order of tree blocks, @@ -4738,8 +4732,8 @@ loop: ut_a(btr_page_get_level(page) == level); - right_page_no = btr_page_get_next(page); - left_page_no = btr_page_get_prev(page); + uint32_t right_page_no = btr_page_get_next(page); + uint32_t left_page_no = btr_page_get_prev(page); ut_a(!page_is_empty(page) || (level == 0 @@ -4860,8 +4854,7 @@ loop: rec = btr_cur_get_rec(&node_cur); fprintf(stderr, "\n" - "InnoDB: node ptr child page n:o " - ULINTPF "\n", + "InnoDB: node ptr child page n:o %u\n", btr_node_ptr_get_child_page_no(rec, offsets)); fputs("InnoDB: record on page ", stderr); @@ -5096,7 +5089,7 @@ bool btr_can_merge_with_page( /*====================*/ btr_cur_t* cursor, /*!< in: cursor on the page to merge */ - ulint page_no, /*!< in: a sibling page */ + uint32_t page_no, /*!< in: a sibling page */ buf_block_t** merge_block, /*!< out: the merge block */ mtr_t* mtr) /*!< in: mini-transaction */ { diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index e64f3c8c803..791d1d84b53 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -43,7 +43,6 @@ PageBulk::init() { buf_block_t* new_block; page_t* new_page; - ulint new_page_no; ut_ad(m_heap == NULL); m_heap = mem_heap_create(1000); @@ -81,7 +80,7 @@ PageBulk::init() alloc_mtr.commit(); new_page = buf_block_get_frame(new_block); - new_page_no = page_get_page_no(new_page); + m_page_no = new_block->page.id().page_no(); byte* index_id = my_assume_aligned<2> (PAGE_HEADER + PAGE_INDEX_ID + new_page); @@ -108,8 +107,7 @@ PageBulk::init() false, &m_mtr); new_page = buf_block_get_frame(new_block); - new_page_no = page_get_page_no(new_page); - ut_ad(m_page_no == new_page_no); + ut_ad(new_block->page.id().page_no() == m_page_no); ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW); @@ -125,7 +123,6 @@ PageBulk::init() m_block = new_block; m_page = new_page; - m_page_no = new_page_no; m_cur_rec = page_get_infimum_rec(new_page); ut_ad(m_is_comp == !!page_is_comp(new_page)); m_free_space = page_get_free_space_of_empty(m_is_comp); @@ -1163,7 +1160,7 @@ if no error occurs. dberr_t BtrBulk::finish(dberr_t err) { - ulint last_page_no = FIL_NULL; + uint32_t last_page_no = FIL_NULL; ut_ad(!m_index->table->is_temporary()); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index f7c0e080cdd..8fec8a8a824 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -770,20 +770,16 @@ btr_cur_optimistic_latch_leaves( unsigned line, mtr_t* mtr) { - rw_lock_type_t mode; - ulint left_page_no; - ulint curr_page_no; - switch (*latch_mode) { + default: + ut_error; + return(false); case BTR_SEARCH_LEAF: case BTR_MODIFY_LEAF: return(buf_page_optimistic_get(*latch_mode, block, modify_clock, file, line, mtr)); case BTR_SEARCH_PREV: case BTR_MODIFY_PREV: - mode = *latch_mode == BTR_SEARCH_PREV - ? RW_S_LATCH : RW_X_LATCH; - if (block->page.state() != BUF_BLOCK_FILE_PAGE) { return(false); } @@ -793,13 +789,15 @@ btr_cur_optimistic_latch_leaves( rw_lock_s_lock(&block->lock); if (block->modify_clock != modify_clock) { rw_lock_s_unlock(&block->lock); - - goto unpin_failed; + break; } - curr_page_no = block->page.id().page_no(); - left_page_no = btr_page_get_prev(block->frame); + const uint32_t curr_page_no = block->page.id().page_no(); + const uint32_t left_page_no = btr_page_get_prev(block->frame); rw_lock_s_unlock(&block->lock); + const rw_lock_type_t mode = *latch_mode == BTR_SEARCH_PREV + ? RW_S_LATCH : RW_X_LATCH; + if (left_page_no != FIL_NULL) { dberr_t err = DB_SUCCESS; cursor->left_block = buf_page_get_gen( @@ -818,7 +816,7 @@ btr_cur_optimistic_latch_leaves( /* release the left block */ btr_leaf_page_release( cursor->left_block, mode, mtr); - goto unpin_failed; + break; } } else { cursor->left_block = NULL; @@ -841,15 +839,11 @@ btr_cur_optimistic_latch_leaves( btr_leaf_page_release(cursor->left_block, mode, mtr); } -unpin_failed: - /* unpin the block */ - buf_block_buf_fix_dec(block); - return(false); - - default: - ut_error; - return(false); } + + /* unpin the block */ + buf_block_buf_fix_dec(block); + return false; } /** @@ -1713,7 +1707,7 @@ retry_page_get: if (retrying_for_search_prev && height != 0) { /* also latch left sibling */ - ulint left_page_no; + uint32_t left_page_no; buf_block_t* get_block; ut_ad(rw_latch == RW_NO_LATCH); @@ -7026,7 +7020,7 @@ btr_cur_unmark_extern_fields( Returns the length of a BLOB part stored on the header page. @return part length */ static -ulint +uint32_t btr_blob_get_part_len( /*==================*/ const byte* blob_header) /*!< in: blob header */ @@ -7038,7 +7032,7 @@ btr_blob_get_part_len( Returns the page number where the next BLOB part is stored. @return page number or FIL_NULL if no more pages */ static -ulint +uint32_t btr_blob_get_next_page_no( /*======================*/ const byte* blob_header) /*!< in: blob header */ @@ -7118,12 +7112,13 @@ struct btr_blob_log_check_t { { dict_index_t* index = m_pcur->index(); ulint offs = 0; - ulint page_no = ULINT_UNDEFINED; + uint32_t page_no = FIL_NULL; if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) { offs = page_offset(*m_rec); page_no = (*m_block)->page.id().page_no(); buf_block_buf_fix_inc(*m_block, __FILE__, __LINE__); + ut_ad(page_no != FIL_NULL); } else { btr_pcur_store_position(m_pcur, m_mtr); } @@ -7140,7 +7135,7 @@ struct btr_blob_log_check_t { m_mtr->set_log_mode(log_mode); index->set_modified(*m_mtr); - if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) { + if (UNIV_UNLIKELY(page_no != FIL_NULL)) { m_pcur->btr_cur.page_cur.block = btr_block_get( *index, page_no, RW_X_LATCH, false, m_mtr); m_pcur->btr_cur.page_cur.rec @@ -7203,14 +7198,10 @@ btr_store_big_rec_extern_fields( committed and restarted. */ enum blob_op op) /*! in: operation code */ { - ulint rec_page_no; byte* field_ref; ulint extern_len; ulint store_len; - ulint page_no; ulint space_id; - ulint prev_page_no; - ulint hint_page_no; ulint i; mtr_t mtr; mem_heap_t* heap = NULL; @@ -7234,7 +7225,6 @@ btr_store_big_rec_extern_fields( &rec, op); page_zip = buf_block_get_page_zip(rec_block); space_id = rec_block->page.id().space(); - rec_page_no = rec_block->page.id().page_no(); ut_a(fil_page_index_page_check(page_align(rec)) || op == BTR_STORE_INSERT_BULK); @@ -7297,7 +7287,7 @@ btr_store_big_rec_extern_fields( MEM_CHECK_DEFINED(big_rec_vec->fields[i].data, extern_len); ut_a(extern_len > 0); - prev_page_no = FIL_NULL; + uint32_t prev_page_no = FIL_NULL; if (page_zip) { int err = deflateReset(&c_stream); @@ -7323,7 +7313,6 @@ btr_store_big_rec_extern_fields( rec, offsets, field_no); page_zip = buf_block_get_page_zip(rec_block); - rec_page_no = rec_block->page.id().page_no(); } mtr.start(); @@ -7333,10 +7322,9 @@ btr_store_big_rec_extern_fields( buf_page_get(rec_block->page.id(), rec_block->zip_size(), RW_X_LATCH, &mtr); - if (prev_page_no == FIL_NULL) { - hint_page_no = 1 + rec_page_no; - } else { - hint_page_no = prev_page_no + 1; + uint32_t hint_prev = prev_page_no; + if (hint_prev == FIL_NULL) { + hint_prev = rec_block->page.id().page_no(); } if (!fsp_reserve_free_extents(&r_extents, @@ -7347,14 +7335,14 @@ btr_store_big_rec_extern_fields( goto func_exit; } - block = btr_page_alloc(index, hint_page_no, FSP_NO_DIR, - 0, &mtr, &mtr); + block = btr_page_alloc(index, hint_prev + 1, + FSP_NO_DIR, 0, &mtr, &mtr); index->table->space->release_free_extents(r_extents); ut_a(block != NULL); - page_no = block->page.id().page_no(); + const uint32_t page_no = block->page.id().page_no(); if (prev_page_no != FIL_NULL) { buf_block_t* prev_block; @@ -7632,12 +7620,12 @@ btr_free_externally_stored_field( X-latch to the index tree */ { page_t* page; - const ulint space_id = mach_read_from_4( + const uint32_t space_id = mach_read_from_4( field_ref + BTR_EXTERN_SPACE_ID); - const ulint start_page = mach_read_from_4( + const uint32_t start_page = mach_read_from_4( field_ref + BTR_EXTERN_PAGE_NO); - ulint page_no; - ulint next_page_no; + uint32_t page_no; + uint32_t next_page_no; mtr_t mtr; ut_ad(index->is_primary()); @@ -7870,10 +7858,9 @@ btr_copy_blob_prefix( /*=================*/ byte* buf, /*!< out: the externally stored part of the field, or a prefix of it */ - ulint len, /*!< in: length of buf, in bytes */ - ulint space_id,/*!< in: space id of the BLOB pages */ - ulint page_no,/*!< in: page number of the first BLOB page */ - ulint offset) /*!< in: offset on the first BLOB page */ + uint32_t len, /*!< in: length of buf, in bytes */ + page_id_t id, /*!< in: page identifier of the first BLOB page */ + uint32_t offset) /*!< in: offset on the first BLOB page */ { ulint copied_len = 0; @@ -7887,8 +7874,7 @@ btr_copy_blob_prefix( mtr_start(&mtr); - block = buf_page_get(page_id_t(space_id, page_no), - 0, RW_S_LATCH, &mtr); + block = buf_page_get(id, 0, RW_S_LATCH, &mtr); buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE); page = buf_block_get_frame(block); @@ -7902,11 +7888,11 @@ btr_copy_blob_prefix( blob_header + BTR_BLOB_HDR_SIZE, copy_len); copied_len += copy_len; - page_no = btr_blob_get_next_page_no(blob_header); + id.set_page_no(btr_blob_get_next_page_no(blob_header)); mtr_commit(&mtr); - if (page_no == FIL_NULL || copy_len != part_len) { + if (id.page_no() == FIL_NULL || copy_len != part_len) { MEM_CHECK_DEFINED(buf, copied_len); return(copied_len); } @@ -7927,18 +7913,16 @@ by a lock or a page latch. or a prefix of it @param[in] len length of buf, in bytes @param[in] zip_size ROW_FORMAT=COMPRESSED page size -@param[in] space_id space id of the BLOB pages -@param[in] offset offset on the first BLOB page +@param[in] id page identifier of the BLOB pages @return number of bytes written to buf */ static ulint btr_copy_zblob_prefix( byte* buf, - ulint len, + uint32_t len, ulint zip_size, - ulint space_id, - ulint page_no, - ulint offset) + page_id_t id, + uint32_t offset) { ulint page_type = FIL_PAGE_TYPE_ZBLOB; mem_heap_t* heap; @@ -7957,25 +7941,23 @@ btr_copy_zblob_prefix( ut_ad(zip_size); ut_ad(ut_is_2pow(zip_size)); - ut_ad(space_id); + ut_ad(id.space()); err = inflateInit(&d_stream); ut_a(err == Z_OK); for (;;) { buf_page_t* bpage; - ulint next_page_no; + uint32_t next_page_no; /* There is no latch on bpage directly. Instead, bpage is protected by the B-tree page latch that is being held on the clustered index record, or, in row_merge_copy_blobs(), by an exclusive table lock. */ - bpage = buf_page_get_zip(page_id_t(space_id, page_no), - zip_size); + bpage = buf_page_get_zip(id, zip_size); if (UNIV_UNLIKELY(!bpage)) { - ib::error() << "Cannot load compressed BLOB " - << page_id_t(space_id, page_no); + ib::error() << "Cannot load compressed BLOB " << id; goto func_exit; } @@ -7984,8 +7966,7 @@ btr_copy_zblob_prefix( ib::error() << "Unexpected type " << fil_page_get_type(bpage->zip.data) - << " of compressed BLOB page " - << page_id_t(space_id, page_no); + << " of compressed BLOB page " << id; ut_ad(0); goto end_of_blob; @@ -8020,7 +8001,7 @@ btr_copy_zblob_prefix( default: inflate_error: ib::error() << "inflate() of compressed BLOB page " - << page_id_t(space_id, page_no) + << id << " returned " << err << " (" << d_stream.msg << ")"; @@ -8032,8 +8013,7 @@ inflate_error: if (!d_stream.avail_in) { ib::error() << "Unexpected end of compressed " - << "BLOB page " - << page_id_t(space_id, page_no); + << "BLOB page " << id; } else { err = inflate(&d_stream, Z_FINISH); switch (err) { @@ -8055,7 +8035,7 @@ end_of_blob: /* On other BLOB pages except the first the BLOB header always is at the page header: */ - page_no = next_page_no; + id.set_page_no(next_page_no); offset = FIL_PAGE_NEXT; page_type = FIL_PAGE_TYPE_ZBLOB2; } @@ -8074,31 +8054,24 @@ by a lock or a page latch. field, or a prefix of it @param[in] len length of buf, in bytes @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] space_id space id of the first BLOB page -@param[in] page_no page number of the first BLOB page +@param[in] id page identifier of the first BLOB page @param[in] offset offset on the first BLOB page @return number of bytes written to buf */ static ulint btr_copy_externally_stored_field_prefix_low( byte* buf, - ulint len, + uint32_t len, ulint zip_size, - ulint space_id, - ulint page_no, - ulint offset) + page_id_t id, + uint32_t offset) { - if (len == 0) { - return(0); - } + if (len == 0) + return 0; - if (zip_size) { - return(btr_copy_zblob_prefix(buf, len, zip_size, - space_id, page_no, offset)); - } else { - return(btr_copy_blob_prefix(buf, len, space_id, - page_no, offset)); - } + return zip_size + ? btr_copy_zblob_prefix(buf, len, zip_size, id, offset) + : btr_copy_blob_prefix(buf, len, id, offset); } /** Copies the prefix of an externally stored field of a record. @@ -8120,10 +8093,6 @@ btr_copy_externally_stored_field_prefix( const byte* data, ulint local_len) { - ulint space_id; - ulint page_no; - ulint offset; - ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE); local_len -= BTR_EXTERN_FIELD_REF_SIZE; @@ -8146,17 +8115,18 @@ btr_copy_externally_stored_field_prefix( return(0); } - space_id = mach_read_from_4(data + BTR_EXTERN_SPACE_ID); - - page_no = mach_read_from_4(data + BTR_EXTERN_PAGE_NO); - - offset = mach_read_from_4(data + BTR_EXTERN_OFFSET); + uint32_t space_id = mach_read_from_4(data + BTR_EXTERN_SPACE_ID); + uint32_t page_no = mach_read_from_4(data + BTR_EXTERN_PAGE_NO); + uint32_t offset = mach_read_from_4(data + BTR_EXTERN_OFFSET); + len -= local_len; return(local_len + btr_copy_externally_stored_field_prefix_low(buf + local_len, - len - local_len, + uint32_t(len), zip_size, - space_id, page_no, + page_id_t( + space_id, + page_no), offset)); } @@ -8178,26 +8148,24 @@ btr_copy_externally_stored_field( ulint local_len, mem_heap_t* heap) { - ulint space_id; - ulint page_no; - ulint offset; - ulint extern_len; byte* buf; ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE); local_len -= BTR_EXTERN_FIELD_REF_SIZE; - space_id = mach_read_from_4(data + local_len + BTR_EXTERN_SPACE_ID); - - page_no = mach_read_from_4(data + local_len + BTR_EXTERN_PAGE_NO); - - offset = mach_read_from_4(data + local_len + BTR_EXTERN_OFFSET); + uint32_t space_id = mach_read_from_4(data + local_len + + BTR_EXTERN_SPACE_ID); + uint32_t page_no = mach_read_from_4(data + local_len + + BTR_EXTERN_PAGE_NO); + uint32_t offset = mach_read_from_4(data + local_len + + BTR_EXTERN_OFFSET); /* Currently a BLOB cannot be bigger than 4 GB; we leave the 4 upper bytes in the length field unused */ - extern_len = mach_read_from_4(data + local_len + BTR_EXTERN_LEN + 4); + uint32_t extern_len = mach_read_from_4(data + local_len + + BTR_EXTERN_LEN + 4); buf = (byte*) mem_heap_alloc(heap, local_len + extern_len); @@ -8206,8 +8174,10 @@ btr_copy_externally_stored_field( + btr_copy_externally_stored_field_prefix_low(buf + local_len, extern_len, zip_size, - space_id, - page_no, offset); + page_id_t( + space_id, + page_no), + offset); return(buf); } diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 80d5031d80b..2c4c338ce70 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -619,7 +619,7 @@ btr_defragment_n_pages( blocks[0] = block; for (uint i = 1; i <= n_pages; i++) { page_t* page = buf_block_get_frame(blocks[i-1]); - ulint page_no = btr_page_get_next(page); + uint32_t page_no = btr_page_get_next(page); total_data_size += page_get_data_size(page); total_n_recs += page_get_n_recs(page); if (page_no == FIL_NULL) { diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc index a83d0840cb5..b8ed7bb3f36 100644 --- a/storage/innobase/buf/buf0buddy.cc +++ b/storage/innobase/buf/buf0buddy.cc @@ -480,8 +480,6 @@ static bool buf_buddy_relocate(void* src, void* dst, ulint i, bool force) { buf_page_t* bpage; const ulint size = BUF_BUDDY_LOW << i; - ulint space; - ulint offset; mysql_mutex_assert_owner(&buf_pool.mutex); ut_ad(!ut_align_offset(src, size)); @@ -489,10 +487,10 @@ static bool buf_buddy_relocate(void* src, void* dst, ulint i, bool force) ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN)); MEM_CHECK_ADDRESSABLE(dst, size); - space = mach_read_from_4((const byte*) src - + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); - offset = mach_read_from_4((const byte*) src - + FIL_PAGE_OFFSET); + uint32_t space = mach_read_from_4(static_cast<const byte*>(src) + + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); + uint32_t offset = mach_read_from_4(static_cast<const byte*>(src) + + FIL_PAGE_OFFSET); /* Suppress Valgrind or MSAN warnings. */ MEM_MAKE_DEFINED(&space, sizeof space); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 1f3cbb56234..8c296c4f03b 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -719,9 +719,9 @@ static void buf_page_check_lsn(bool check_lsn, const byte* read_buf) phase it makes no sense to spam the log with error messages. */ if (current_lsn < page_lsn) { - const ulint space_id = mach_read_from_4( + const uint32_t space_id = mach_read_from_4( read_buf + FIL_PAGE_SPACE_ID); - const ulint page_no = mach_read_from_4( + const uint32_t page_no = mach_read_from_4( read_buf + FIL_PAGE_OFFSET); ib::error() << "Page " << page_id_t(space_id, page_no) diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index d9faf2ffe06..ad515e4e194 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -125,7 +125,7 @@ too_small: byte *fseg_header= TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG + trx_sys_block->frame; - for (ulint prev_page_no= 0, i= 0; i < 2 * size + FSP_EXTENT_SIZE / 2; i++) + for (uint32_t prev_page_no= 0, i= 0; i < 2 * size + FSP_EXTENT_SIZE / 2; i++) { buf_block_t *new_block= fseg_alloc_free_page(fseg_header, prev_page_no + 1, FSP_UP, &mtr); @@ -335,7 +335,7 @@ void buf_dblwr_t::recover() if (!is_initialised()) return; - ulint page_no_dblwr= 0; + uint32_t page_no_dblwr= 0; byte *read_buf= static_cast<byte*>(aligned_malloc(3 * srv_page_size, srv_page_size)); byte *const buf= read_buf + srv_page_size; @@ -344,7 +344,7 @@ void buf_dblwr_t::recover() i != recv_sys.dblwr.pages.end(); ++i, ++page_no_dblwr) { byte *page= *i; - const ulint page_no= page_get_page_no(page); + const uint32_t page_no= page_get_page_no(page); if (!page_no) /* recovered via Datafile::restore_from_doublewrite() */ continue; diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index 01b523d6e94..ee9be7e47d2 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -489,8 +489,8 @@ buf_load() page_id_t* dump; ulint dump_n; ulint i; - ulint space_id; - ulint page_no; + uint32_t space_id; + uint32_t page_no; int fscanf_ret; /* Ignore any leftovers from before */ @@ -514,7 +514,7 @@ buf_load() This file is tiny (approx 500KB per 1GB buffer pool), reading it two times is fine. */ dump_n = 0; - while (fscanf(f, ULINTPF "," ULINTPF, &space_id, &page_no) == 2 + while (fscanf(f, "%u,%u", &space_id, &page_no) == 2 && !SHUTTING_DOWN()) { dump_n++; } @@ -565,8 +565,7 @@ buf_load() export_vars.innodb_buffer_pool_load_incomplete = 1; for (i = 0; i < dump_n && !SHUTTING_DOWN(); i++) { - fscanf_ret = fscanf(f, ULINTPF "," ULINTPF, - &space_id, &page_no); + fscanf_ret = fscanf(f, "%u,%u", &space_id, &page_no); if (fscanf_ret != 2) { if (feof(f)) { @@ -588,9 +587,8 @@ buf_load() fclose(f); buf_load_status(STATUS_ERR, "Error parsing '%s': bogus" - " space,page " ULINTPF "," ULINTPF - " at line " ULINTPF "," - " unable to load buffer pool", + " space,page %u,%u at line " ULINTPF + ", unable to load buffer pool", full_filename, space_id, page_no, i); diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index d843865d0a9..f4207ff393e 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -411,8 +411,7 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) ulint count= 5 + buf_read_ahead_area / 8; const page_id_t low= page_id - (page_id.page_no() % buf_read_ahead_area); page_id_t high= low + buf_read_ahead_area; - high.set_page_no(std::min(high.page_no(), - static_cast<uint32_t>(space->committed_size - 1))); + high.set_page_no(std::min(high.page_no(), space->committed_size - 1)); /* Count how many blocks in the area have been recently accessed, that is, reside near the start of the LRU list. */ @@ -723,13 +722,9 @@ for the highest address page to get read in, before this function returns @param[in] space_id tablespace id @param[in] page_nos array of page numbers to read, with the highest page number the last in the array -@param[in] n_stored number of page numbers in the array */ -void -buf_read_recv_pages( - bool sync, - ulint space_id, - const ulint* page_nos, - ulint n_stored) +@param[in] n number of page numbers in the array */ +void buf_read_recv_pages(bool sync, ulint space_id, const uint32_t *page_nos, + ulint n) { fil_space_t* space = fil_space_get(space_id); @@ -742,11 +737,10 @@ buf_read_recv_pages( const ulint zip_size = space->zip_size(); - for (ulint i = 0; i < n_stored; i++) { + for (ulint i = 0; i < n; i++) { /* Ignore if the page already present in freed ranges. */ - if (space->freed_ranges.contains( - static_cast<uint32_t>(page_nos[i]))) { + if (space->freed_ranges.contains(page_nos[i])) { continue; } @@ -772,7 +766,7 @@ buf_read_recv_pages( dberr_t err; buf_read_page_low( - &err, sync && i + 1 == n_stored, + &err, sync && i + 1 == n, BUF_READ_ANY_PAGE, cur_page_id, zip_size, true); if (err == DB_DECRYPTION_FAILED || err == DB_PAGE_CORRUPTED) { @@ -781,6 +775,5 @@ buf_read_recv_pages( } } - DBUG_PRINT("ib_buf", ("recovery read-ahead (%u pages)", - unsigned(n_stored))); + DBUG_PRINT("ib_buf", ("recovery read-ahead (%u pages)", n)); } diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 131df87b383..5587355f23a 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1122,7 +1122,7 @@ struct rotate_thread_t { uint thread_no; bool first; /*!< is position before first space */ fil_space_t* space; /*!< current space or NULL */ - ulint offset; /*!< current offset */ + uint32_t offset; /*!< current page number */ ulint batch; /*!< #pages to rotate */ uint min_key_version_found;/*!< min key version found but not rotated */ lsn_t end_lsn; /*!< max lsn when rotating this space */ @@ -1694,7 +1694,7 @@ fil_crypt_find_page_to_rotate( } } - crypt_data->rotate_state.next_offset += batch; + crypt_data->rotate_state.next_offset += uint32_t(batch); mutex_exit(&crypt_data->mutex); return found; } @@ -1716,7 +1716,7 @@ static buf_block_t* fil_crypt_get_page_throttle_func( rotate_thread_t* state, - ulint offset, + uint32_t offset, mtr_t* mtr, ulint* sleeptime_ms, const char* file, @@ -1792,7 +1792,7 @@ fil_crypt_rotate_page( { fil_space_t*space = state->space; ulint space_id = space->id; - ulint offset = state->offset; + uint32_t offset = state->offset; ulint sleeptime_ms = 0; fil_space_crypt_t *crypt_data = space->crypt_data; @@ -1916,9 +1916,9 @@ fil_crypt_rotate_pages( const key_state_t* key_state, rotate_thread_t* state) { - ulint space = state->space->id; - ulint end = std::min(state->offset + state->batch, - state->space->free_limit); + ulint space_id = state->space->id; + uint32_t end = std::min(state->offset + uint32_t(state->batch), + state->space->free_limit); ut_ad(state->space->referenced()); @@ -1932,7 +1932,7 @@ fil_crypt_rotate_pages( * real pages, they will be updated anyway when the * real page is updated */ - if (buf_dblwr.is_inside(page_id_t(space, state->offset))) { + if (buf_dblwr.is_inside(page_id_t(space_id, state->offset))) { continue; } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 93047391aa2..7662a4b643c 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -354,8 +354,8 @@ static bool fil_comp_algo_validate(const fil_space_t* space) or ULINT_MAX for unlimited @return file object */ fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle, - ulint size, bool is_raw, bool atomic_write, - ulint max_pages) + uint32_t size, bool is_raw, bool atomic_write, + uint32_t max_pages) { fil_node_t* node; @@ -668,7 +668,7 @@ bool fil_space_extend_must_retry( fil_space_t* space, fil_node_t* node, - ulint size, + uint32_t size, bool* success) { ut_ad(mutex_own(&fil_system.mutex)); @@ -707,10 +707,10 @@ fil_space_extend_must_retry( ut_ad(size >= space->size); - ulint last_page_no = space->size; - const ulint file_start_page_no = last_page_no - node->size; + uint32_t last_page_no = space->size; + const uint32_t file_start_page_no = last_page_no - node->size; - const ulint page_size = space->physical_size(); + const unsigned page_size = space->physical_size(); /* Datafile::read_first_page() expects srv_page_size bytes. fil_node_t::read_page0() expects at least 4 * srv_page_size bytes.*/ @@ -732,7 +732,7 @@ fil_space_extend_must_retry( os_offset_t fsize = os_file_get_size(node->handle); ut_a(fsize != os_offset_t(-1)); - last_page_no = ulint(fsize / page_size) + last_page_no = uint32_t(fsize / page_size) + file_start_page_no; } mutex_enter(&fil_system.mutex); @@ -741,11 +741,11 @@ fil_space_extend_must_retry( node->being_extended = false; ut_a(last_page_no - file_start_page_no >= node->size); - ulint file_size = last_page_no - file_start_page_no; + uint32_t file_size = last_page_no - file_start_page_no; space->size += file_size - node->size; node->size = file_size; - const ulint pages_in_MiB = node->size - & ~ulint((1U << (20U - srv_page_size_shift)) - 1); + const uint32_t pages_in_MiB = node->size + & ~uint32_t((1U << (20U - srv_page_size_shift)) - 1); node->complete_io(); @@ -832,7 +832,7 @@ fil_mutex_enter_and_prepare_for_io( } } - ulint size = space->recv_size; + uint32_t size = space->recv_size; if (UNIV_UNLIKELY(size != 0)) { ut_ad(node); bool success; @@ -877,10 +877,7 @@ fil_mutex_enter_and_prepare_for_io( @param[in,out] space tablespace @param[in] size desired size in pages @return whether the tablespace is at least as big as requested */ -bool -fil_space_extend( - fil_space_t* space, - ulint size) +bool fil_space_extend(fil_space_t *space, uint32_t size) { ut_ad(!srv_read_only_mode || space->purpose == FIL_TYPE_TEMPORARY); @@ -1305,7 +1302,7 @@ fil_space_get_space( return(space); } -void fil_space_set_recv_size_and_flags(ulint id, ulint size, uint32_t flags) +void fil_space_set_recv_size_and_flags(ulint id, uint32_t size, uint32_t flags) { ut_ad(id < SRV_SPACE_ID_UPPER_BOUND); mutex_enter(&fil_system.mutex); @@ -2589,7 +2586,7 @@ fil_ibd_create( const char* name, const char* path, ulint flags, - ulint size, + uint32_t size, fil_encryption_t mode, uint32_t key_id, dberr_t* err) @@ -3554,7 +3551,7 @@ void fsp_flags_try_adjust(fil_space_t* space, ulint flags) if (buf_block_t* b = buf_page_get( page_id_t(space->id, 0), space->zip_size(), RW_X_LATCH, &mtr)) { - ulint f = fsp_header_get_flags(b->frame); + uint32_t f = fsp_header_get_flags(b->frame); if (fil_space_t::full_crc32(f)) { goto func_exit; } diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index fedade4366f..beebb85c86b 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -45,7 +45,7 @@ Created 11/29/1995 Heikki Tuuri // JAN: MySQL 5.7 Encryption // #include <my_aes.h> -typedef ulint page_no_t; +typedef uint32_t page_no_t; /** Return an extent to the free list of a space. @param[in,out] space tablespace @@ -111,7 +111,7 @@ fseg_alloc_free_page_low( fil_space_t* space, fseg_inode_t* seg_inode, buf_block_t* iblock, - ulint hint, + uint32_t hint, byte direction, #ifdef UNIV_DEBUG bool has_done_reservation, @@ -169,28 +169,29 @@ Find a free page. @param descr extent descriptor @param hint page offset to start searching from (towards larger pages) @return free page offset -@retval ULINT_UNDEFINED if no page is free */ -inline ulint xdes_find_free(const xdes_t *descr, ulint hint= 0) +@retval FIL_NULL if no page is free */ +inline uint32_t xdes_find_free(const xdes_t *descr, uint32_t hint= 0) { - ut_ad(hint < FSP_EXTENT_SIZE); - for (ulint i= hint; i < FSP_EXTENT_SIZE; i++) + const uint32_t extent_size= FSP_EXTENT_SIZE; + ut_ad(hint < extent_size); + for (uint32_t i= hint; i < extent_size; i++) if (xdes_is_free(descr, i)) return i; - for (ulint i= 0; i < hint; i++) + for (uint32_t i= 0; i < hint; i++) if (xdes_is_free(descr, i)) return i; - return ULINT_UNDEFINED; + return FIL_NULL; } /** Determine the number of used pages in a descriptor. @param descr file descriptor @return number of pages used */ -inline ulint xdes_get_n_used(const xdes_t *descr) +inline uint32_t xdes_get_n_used(const xdes_t *descr) { - ulint count= 0; + uint32_t count= 0; - for (ulint i= 0; i < FSP_EXTENT_SIZE; ++i) + for (uint32_t i= FSP_EXTENT_SIZE; i--; ) if (!xdes_is_free(descr, i)) count++; @@ -317,16 +318,14 @@ xdes_get_descriptor_with_space_hdr( mtr_t* mtr, bool init_space = false) { - ulint limit; - ulint size; - ulint descr_page_no; ut_ad(mtr->memo_contains(*space)); ut_ad(mtr->memo_contains_flagged(header, MTR_MEMO_PAGE_SX_FIX | MTR_MEMO_PAGE_X_FIX)); /* Read free limit and space size */ - limit = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT - + header->frame); - size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + header->frame); + uint32_t limit = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT + + header->frame); + uint32_t size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + + header->frame); ut_ad(limit == space->free_limit || (space->free_limit == 0 && (init_space @@ -340,9 +339,9 @@ xdes_get_descriptor_with_space_hdr( return(NULL); } - const ulint zip_size = space->zip_size(); + const unsigned zip_size = space->zip_size(); - descr_page_no = xdes_calc_descriptor_page(zip_size, offset); + uint32_t descr_page_no = xdes_calc_descriptor_page(zip_size, offset); buf_block_t* block = header; @@ -455,17 +454,12 @@ xdes_lst_get_descriptor( /********************************************************************//** Returns page offset of the first page in extent described by a descriptor. @return offset of the first page in extent */ -UNIV_INLINE -ulint -xdes_get_offset( -/*============*/ - const xdes_t* descr) /*!< in: extent descriptor */ +static uint32_t xdes_get_offset(const xdes_t *descr) { - ut_ad(descr); - - return(page_get_page_no(page_align(descr)) - + ((page_offset(descr) - XDES_ARR_OFFSET) / XDES_SIZE) - * FSP_EXTENT_SIZE); + ut_ad(descr); + return page_get_page_no(page_align(descr)) + + uint32_t(((page_offset(descr) - XDES_ARR_OFFSET) / XDES_SIZE) * + FSP_EXTENT_SIZE); } /** Initialize a file page whose prior contents should be ignored. @@ -548,7 +542,7 @@ fsp_header_init_fields( @param[in,out] space tablespace @param[in] size current size in blocks @param[in,out] mtr mini-transaction */ -void fsp_header_init(fil_space_t* space, ulint size, mtr_t* mtr) +void fsp_header_init(fil_space_t* space, uint32_t size, mtr_t* mtr) { const page_id_t page_id(space->id, 0); const ulint zip_size = space->zip_size(); @@ -627,7 +621,7 @@ static ATTRIBUTE_COLD __attribute__((warn_unused_result)) bool fsp_try_extend_data_file_with_pages( fil_space_t* space, - ulint page_no, + uint32_t page_no, buf_block_t* header, mtr_t* mtr) { @@ -658,9 +652,9 @@ fsp_try_extend_data_file_with_pages( /** Calculate the number of physical pages in an extent for this file. @param[in] physical_size page_size of the datafile @return number of pages in an extent for this file */ -inline ulint fsp_get_extent_size_in_pages(ulint physical_size) +inline uint32_t fsp_get_extent_size_in_pages(ulint physical_size) { - return (FSP_EXTENT_SIZE << srv_page_size_shift) / physical_size; + return uint32_t((FSP_EXTENT_SIZE << srv_page_size_shift) / physical_size); } @@ -676,12 +670,13 @@ on one extent descriptor page. See xdes_calc_descriptor_page(). @param[in] physical_size page size in data file @param[in] size current number of pages in the datafile @return number of pages to extend the file. */ -static ulint fsp_get_pages_to_extend_ibd(ulint physical_size, ulint size) +static uint32_t fsp_get_pages_to_extend_ibd(unsigned physical_size, + uint32_t size) { - ulint extent_size = fsp_get_extent_size_in_pages(physical_size); + uint32_t extent_size = fsp_get_extent_size_in_pages(physical_size); /* The threshold is set at 32MiB except when the physical page size is small enough that it must be done sooner. */ - ulint threshold = std::min(32 * extent_size, physical_size); + uint32_t threshold = std::min(32 * extent_size, physical_size); if (size >= threshold) { /* Below in fsp_fill_free_list() we assume @@ -704,8 +699,6 @@ static ulint fsp_try_extend_data_file(fil_space_t *space, buf_block_t *header, mtr_t *mtr) { - ulint size; /* current number of pages in the datafile */ - ulint size_increase; /* number of pages to extend this file */ const char* OUT_OF_SPACE_MSG = "ran out of space. Please add another file or use" " 'autoextend' for the last file in setting"; @@ -742,10 +735,12 @@ fsp_try_extend_data_file(fil_space_t *space, buf_block_t *header, mtr_t *mtr) return(0); } - size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + header->frame); + uint32_t size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + + header->frame); ut_ad(size == space->size_in_header); + uint32_t size_increase; - const ulint ps = space->physical_size(); + const unsigned ps = space->physical_size(); switch (space->id) { case TRX_SYS_SPACE: @@ -755,7 +750,7 @@ fsp_try_extend_data_file(fil_space_t *space, buf_block_t *header, mtr_t *mtr) size_increase = srv_tmp_space.get_increment(); break; default: - ulint extent_pages = fsp_get_extent_size_in_pages(ps); + uint32_t extent_pages = fsp_get_extent_size_in_pages(ps); if (size < extent_pages) { /* Let us first extend the file to extent_size */ if (!fsp_try_extend_data_file_with_pages( @@ -825,18 +820,13 @@ fsp_fill_free_list( buf_block_t* header, mtr_t* mtr) { - ulint limit; - ulint size; - xdes_t* descr; - ulint count = 0; - ulint i; - ut_d(space->modify_check(*mtr)); /* Check if we can fill free list from above the free list limit */ - size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + header->frame); - limit = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT - + header->frame); + uint32_t size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + + header->frame); + uint32_t limit = mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT + + header->frame); ut_ad(size == space->size_in_header); ut_ad(limit == space->free_limit); @@ -860,17 +850,18 @@ fsp_fill_free_list( } } - i = limit; - - while ((init_space && i < 1) - || ((i + FSP_EXTENT_SIZE <= size) && (count < FSP_FREE_ADD))) { + uint32_t count = 0; - const bool init_xdes = 0 - == ut_2pow_remainder(i, ulint(space->physical_size())); + for (uint32_t i = limit, extent_size = FSP_EXTENT_SIZE, + physical_size = space->physical_size(); + (init_space && i < 1) + || (i + extent_size <= size && count < FSP_FREE_ADD); + i += extent_size) { + const bool init_xdes = !ut_2pow_remainder(i, physical_size); - space->free_limit = i + FSP_EXTENT_SIZE; + space->free_limit = i + extent_size; mtr->write<4>(*header, FSP_HEADER_OFFSET + FSP_FREE_LIMIT - + header->frame, i + FSP_EXTENT_SIZE); + + header->frame, i + extent_size); if (init_xdes) { @@ -914,7 +905,7 @@ fsp_fill_free_list( } buf_block_t* xdes; - descr = xdes_get_descriptor_with_space_hdr( + xdes_t* descr = xdes_get_descriptor_with_space_hdr( header, space, i, &xdes, mtr, init_space); if (xdes != header && !space->full_crc32()) { fil_block_check_type(*xdes, FIL_PAGE_TYPE_XDES, mtr); @@ -946,8 +937,6 @@ fsp_fill_free_list( xdes, xoffset, mtr); count++; } - - i += FSP_EXTENT_SIZE; } space->free_len += count; @@ -964,7 +953,7 @@ static xdes_t* fsp_alloc_free_extent( fil_space_t* space, - ulint hint, + uint32_t hint, buf_block_t** xdes, mtr_t* mtr) { @@ -1076,13 +1065,12 @@ static MY_ATTRIBUTE((warn_unused_result, nonnull)) buf_block_t* fsp_alloc_free_page( fil_space_t* space, - ulint hint, + uint32_t hint, mtr_t* mtr, mtr_t* init_mtr) { fil_addr_t first; xdes_t* descr; - ulint free; const ulint space_id = space->id; ut_d(space->modify_check(*mtr)); @@ -1133,8 +1121,8 @@ fsp_alloc_free_page( /* Now we have in descr an extent with at least one free page. Look for a free page in the extent. */ - free = xdes_find_free(descr, hint % FSP_EXTENT_SIZE); - if (free == ULINT_UNDEFINED) { + uint32_t free = xdes_find_free(descr, hint % FSP_EXTENT_SIZE); + if (free == FIL_NULL) { ut_print_buf(stderr, ((byte*) descr) - 500, 1000); putc('\n', stderr); @@ -1142,10 +1130,10 @@ fsp_alloc_free_page( ut_error; } - page_no_t page_no = xdes_get_offset(descr) + free; + uint32_t page_no = xdes_get_offset(descr) + free; - page_no_t space_size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE - + block->frame); + uint32_t space_size = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SIZE + + block->frame); ut_ad(space_size == space->size_in_header || (space_id == TRX_SYS_SPACE && srv_startup_is_before_trx_rollback_phase)); @@ -1545,7 +1533,7 @@ fseg_inode_get( @param n slot index @return page number @retval FIL_NULL if not in use */ -static ulint fseg_get_nth_frag_page_no(const fseg_inode_t *inode, ulint n) +static uint32_t fseg_get_nth_frag_page_no(const fseg_inode_t *inode, ulint n) { ut_ad(inode); ut_ad(n < FSEG_FRAG_ARR_N_SLOTS); @@ -1808,7 +1796,7 @@ fseg_fill_free_list( fseg_inode_t* inode, buf_block_t* iblock, fil_space_t* space, - ulint hint, + uint32_t hint, mtr_t* mtr) { xdes_t* descr; @@ -1945,7 +1933,7 @@ fseg_alloc_free_page_low( fil_space_t* space, fseg_inode_t* seg_inode, buf_block_t* iblock, - ulint hint, + uint32_t hint, byte direction, #ifdef UNIV_DEBUG bool has_done_reservation, @@ -1958,7 +1946,7 @@ fseg_alloc_free_page_low( ulint used; ulint reserved; xdes_t* descr; /*!< extent of the hinted page */ - ulint ret_page; /*!< the allocated page offset, FIL_NULL + uint32_t ret_page; /*!< the allocated page offset, FIL_NULL if could not be allocated */ xdes_t* ret_descr; /*!< the extent of the allocated page */ buf_block_t* xdes; @@ -2060,9 +2048,12 @@ take_hinted_page: segment) ========*/ ret_descr = descr; - ret_page = xdes_get_offset(ret_descr) - + xdes_find_free(ret_descr, hint % FSP_EXTENT_SIZE); - ut_ad(!has_done_reservation || ret_page != FIL_NULL); + ret_page = xdes_find_free(ret_descr, hint % FSP_EXTENT_SIZE); + if (ret_page == FIL_NULL) { + ut_ad(!has_done_reservation); + } else { + ret_page += xdes_get_offset(ret_descr); + } /*-----------------------------------------------------------*/ } else if (reserved - used > 0) { /* 5. We take any unused page from the segment @@ -2079,9 +2070,12 @@ take_hinted_page: } ret_descr = xdes_lst_get_descriptor(space, first, &xdes, mtr); - ret_page = xdes_get_offset(ret_descr) - + xdes_find_free(ret_descr); - ut_ad(!has_done_reservation || ret_page != FIL_NULL); + ret_page = xdes_find_free(ret_descr); + if (ret_page == FIL_NULL) { + ut_ad(!has_done_reservation); + } else { + ret_page += xdes_get_offset(ret_descr); + } /*-----------------------------------------------------------*/ } else if (used < FSEG_FRAG_LIMIT) { /* 6. We allocate an individual page from the space @@ -2180,7 +2174,7 @@ buf_block_t* fseg_alloc_free_page_general( /*=========================*/ fseg_header_t* seg_header,/*!< in/out: segment header */ - ulint hint, /*!< in: hint of which page would be + uint32_t hint, /*!< in: hint of which page would be desirable */ byte direction,/*!< in: if the new page is needed because of an index page split, and records are @@ -2254,10 +2248,9 @@ fsp_reserve_free_pages( buf_block_t* header, ulint size, mtr_t* mtr, - ulint n_pages) + uint32_t n_pages) { xdes_t* descr; - ulint n_used; ut_a(!is_system_tablespace(space->id)); ut_a(size < FSP_EXTENT_SIZE); @@ -2265,7 +2258,7 @@ fsp_reserve_free_pages( buf_block_t* xdes; descr = xdes_get_descriptor_with_space_hdr(header, space, 0, &xdes, mtr); - n_used = xdes_get_n_used(descr); + uint32_t n_used = xdes_get_n_used(descr); ut_a(n_used <= size); @@ -2319,7 +2312,7 @@ fsp_reserve_free_extents( ulint n_ext, fsp_reserve_t alloc_type, mtr_t* mtr, - ulint n_pages) + uint32_t n_pages) { ulint n_free_list_ext; ulint free_limit; @@ -2537,7 +2530,7 @@ void fseg_free_page( fseg_header_t* seg_header, fil_space_t* space, - ulint offset, + uint32_t offset, mtr_t* mtr) { DBUG_ENTER("fseg_free_page"); @@ -2600,7 +2593,7 @@ fseg_free_extent( fseg_inode_t* seg_inode, buf_block_t* iblock, fil_space_t* space, - ulint page, + uint32_t page, mtr_t* mtr) { @@ -2614,7 +2607,7 @@ fseg_free_extent( ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); ut_d(space->modify_check(*mtr)); - const ulint first_page_in_extent = page - (page % FSP_EXTENT_SIZE); + const uint32_t first_page_in_extent = page - (page % FSP_EXTENT_SIZE); const uint16_t xoffset= uint16_t(descr - xdes->frame + XDES_FLST_NODE); const uint16_t ioffset= uint16_t(seg_inode - iblock->frame); @@ -2629,9 +2622,9 @@ fseg_free_extent( flst_remove(iblock, static_cast<uint16_t>(FSEG_NOT_FULL + ioffset), xdes, xoffset, mtr); - ulint not_full_n_used = mach_read_from_4( + uint32_t not_full_n_used = mach_read_from_4( FSEG_NOT_FULL_N_USED + seg_inode); - ulint descr_n_used = xdes_get_n_used(descr); + uint32_t descr_n_used = xdes_get_n_used(descr); ut_a(not_full_n_used >= descr_n_used); mtr->write<4>(*iblock, seg_inode + FSEG_NOT_FULL_N_USED, not_full_n_used - descr_n_used); @@ -2663,15 +2656,12 @@ fseg_free_step( mtr_t* mtr) /*!< in/out: mini-transaction */ { ulint n; - ulint page; fseg_inode_t* inode; - ulint space_id; - ulint header_page; DBUG_ENTER("fseg_free_step"); - space_id = page_get_space_id(page_align(header)); - header_page = page_get_page_no(page_align(header)); + const uint32_t space_id = page_get_space_id(page_align(header)); + const uint32_t header_page = page_get_page_no(page_align(header)); fil_space_t* space = mtr_x_lock_space(space_id, mtr); buf_block_t* xdes; @@ -2698,8 +2688,8 @@ fseg_free_step( if (descr != NULL) { /* Free the extent held by the segment */ - page = xdes_get_offset(descr); - fseg_free_extent(inode, iblock, space, page, mtr); + fseg_free_extent(inode, iblock, space, xdes_get_offset(descr), + mtr); DBUG_RETURN(false); } @@ -2741,13 +2731,10 @@ fseg_free_step_not_header( mtr_t* mtr) /*!< in/out: mini-transaction */ { ulint n; - ulint page; xdes_t* descr; fseg_inode_t* inode; - ulint space_id; - ulint page_no; - space_id = page_get_space_id(page_align(header)); + const uint32_t space_id = page_get_space_id(page_align(header)); ut_ad(mtr->is_named_space(space_id)); fil_space_t* space = mtr_x_lock_space(space_id, mtr); @@ -2763,8 +2750,8 @@ fseg_free_step_not_header( if (descr != NULL) { /* Free the extent held by the segment */ - page = xdes_get_offset(descr); - fseg_free_extent(inode, iblock, space, page, mtr); + fseg_free_extent(inode, iblock, space, xdes_get_offset(descr), + mtr); return false; } @@ -2774,7 +2761,7 @@ fseg_free_step_not_header( ut_a(n != ULINT_UNDEFINED); - page_no = fseg_get_nth_frag_page_no(inode, n); + uint32_t page_no = fseg_get_nth_frag_page_no(inode, n); if (page_no == page_get_page_no(page_align(header))) { return true; diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 2e4b3678760..f8342157560 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -47,7 +47,7 @@ SysTablespace srv_tmp_space; /** If the last data file is auto-extended, we add this many pages to it at a time. We have to make this public because it is a config variable. */ -ulong sys_tablespace_auto_extend_increment; +uint sys_tablespace_auto_extend_increment; /** Convert a numeric string that optionally ends in G or M or K, to a number containing megabytes. @@ -275,7 +275,8 @@ SysTablespace::parse_params( } } - m_files.push_back(Datafile(filepath, flags(), size, order)); + m_files.push_back(Datafile(filepath, flags(), uint32_t(size), + order)); Datafile* datafile = &m_files.back(); datafile->make_filepath(path(), filepath, NO_EXT); @@ -351,7 +352,7 @@ SysTablespace::check_size( also the data file could contain an incomplete extent. So we need to round the size downward to a megabyte.*/ - const ulint rounded_size_pages = static_cast<ulint>( + const uint32_t rounded_size_pages = static_cast<uint32_t>( size >> srv_page_size_shift); /* If last file */ @@ -904,7 +905,6 @@ SysTablespace::open_or_create( if (it != begin) { } else if (is_temp) { - ut_ad(!fil_system.temp_space); ut_ad(space_id() == SRV_TMP_SPACE_ID); space = fil_space_create( name(), SRV_TMP_SPACE_ID, flags(), @@ -919,12 +919,10 @@ SysTablespace::open_or_create( ut_ad(!space->is_compressed()); ut_ad(space->full_crc32()); } else { - ut_ad(!fil_system.sys_space); ut_ad(space_id() == TRX_SYS_SPACE); space = fil_space_create( name(), TRX_SYS_SPACE, it->flags(), FIL_TYPE_TABLESPACE, NULL); - mutex_enter(&fil_system.mutex); fil_system.sys_space = space; mutex_exit(&fil_system.mutex); @@ -935,10 +933,10 @@ SysTablespace::open_or_create( ut_a(fil_validate()); - ulint max_size = (++node_counter == m_files.size() + uint32_t max_size = (++node_counter == m_files.size() ? (m_last_file_size_max == 0 - ? ULINT_MAX - : m_last_file_size_max) + ? UINT32_MAX + : uint32_t(m_last_file_size_max)) : it->m_size); space->add(it->m_filepath, OS_FILE_CLOSED, it->m_size, @@ -965,30 +963,21 @@ SysTablespace::normalize_size() /** @return next increment size */ -ulint -SysTablespace::get_increment() const +uint32_t SysTablespace::get_increment() const { - ulint increment; - - if (m_last_file_size_max == 0) { - increment = get_autoextend_increment(); - } else { - - if (!is_valid_size()) { - ib::error() << "The last data file in " << name() - << " has a size of " << last_file_size() - << " but the max size allowed is " - << m_last_file_size_max; - } - - increment = m_last_file_size_max - last_file_size(); - } - - if (increment > get_autoextend_increment()) { - increment = get_autoextend_increment(); - } - - return(increment); + if (m_last_file_size_max == 0) + return get_autoextend_increment(); + + if (!is_valid_size()) + { + ib::error() << "The last data file in " << name() + << " has a size of " << last_file_size() + << " but the max size allowed is " + << m_last_file_size_max; + } + + return std::min(uint32_t(m_last_file_size_max) - last_file_size(), + get_autoextend_increment()); } diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 21783a94e9c..0a0d4242c00 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -1323,8 +1323,8 @@ rtr_cur_restore_position( page_cur_t* page_cursor; node_visit_t* node = rtr_get_parent_node(btr_cur, level, false); node_seq_t path_ssn = node->seq_no; - const ulint zip_size = index->table->space->zip_size(); - ulint page_no = node->page_no; + const unsigned zip_size = index->table->space->zip_size(); + uint32_t page_no = node->page_no; heap = mem_heap_create(256); @@ -1484,14 +1484,13 @@ rtr_non_leaf_insert_stack_push( dict_index_t* index, /*!< in: index descriptor */ rtr_node_path_t* path, /*!< in/out: search path */ ulint level, /*!< in: index page level */ - ulint child_no,/*!< in: child page no */ + uint32_t child_no,/*!< in: child page no */ const buf_block_t* block, /*!< in: block of the page */ const rec_t* rec, /*!< in: positioned record */ double mbr_inc)/*!< in: MBR needs to be enlarged */ { node_seq_t new_seq; btr_pcur_t* my_cursor; - ulint page_no = block->page.id().page_no(); my_cursor = static_cast<btr_pcur_t*>( ut_malloc_nokey(sizeof(*my_cursor))); @@ -1503,8 +1502,8 @@ rtr_non_leaf_insert_stack_push( (btr_pcur_get_btr_cur(my_cursor))->index = index; new_seq = rtr_get_current_ssn_id(index); - rtr_non_leaf_stack_push(path, page_no, new_seq, level, child_no, - my_cursor, mbr_inc); + rtr_non_leaf_stack_push(path, block->page.id().page_no(), + new_seq, level, child_no, my_cursor, mbr_inc); } /** Copy a buf_block_t, except "block->lock". @@ -1827,7 +1826,7 @@ rtr_cur_search_with_match( rtr_info->matches for leaf nodes */ if (rtr_info && mode != PAGE_CUR_RTREE_INSERT) { if (!is_leaf) { - ulint page_no; + uint32_t page_no; node_seq_t new_seq; bool is_loc; @@ -1919,12 +1918,11 @@ rtr_cur_search_with_match( then we select the record that result in least increased area */ if (mode == PAGE_CUR_RTREE_INSERT) { - ulint child_no; ut_ad(least_inc < DBL_MAX); offsets = rec_get_offsets( best_rec, index, offsets, false, ULINT_UNDEFINED, &heap); - child_no = + uint32_t child_no = btr_node_ptr_get_child_page_no( best_rec, offsets); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index dcfd402de0c..546957f8800 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -17452,20 +17452,8 @@ innodb_change_buffer_max_size_update(THD*, st_mysql_sys_var*, void*, } #ifdef UNIV_DEBUG -static ulong srv_fil_make_page_dirty_debug = 0; -static ulong srv_saved_page_number_debug = 0; - -/****************************************************************//** -Save an InnoDB page number. */ -static -void -innodb_save_page_no(THD*, st_mysql_sys_var*, void*, const void* save) -{ - srv_saved_page_number_debug = *static_cast<const ulong*>(save); - - ib::info() << "Saving InnoDB page number: " - << srv_saved_page_number_debug; -} +static uint srv_fil_make_page_dirty_debug = 0; +static uint srv_saved_page_number_debug; /****************************************************************//** Make the first page of given user tablespace dirty. */ @@ -17474,7 +17462,7 @@ void innodb_make_page_dirty(THD*, st_mysql_sys_var*, void*, const void* save) { mtr_t mtr; - ulong space_id = *static_cast<const ulong*>(save); + uint space_id = *static_cast<const uint*>(save); mysql_mutex_unlock(&LOCK_global_system_variables); fil_space_t* space = fil_space_acquire_silent(space_id); @@ -19195,11 +19183,11 @@ static MYSQL_SYSVAR_BOOL(log_optimize_ddl, deprecated::innodb_log_optimize_ddl, PLUGIN_VAR_OPCMDARG, innodb_deprecated_ignored, NULL, innodb_log_optimize_ddl_warn, FALSE); -static MYSQL_SYSVAR_ULONG(autoextend_increment, +static MYSQL_SYSVAR_UINT(autoextend_increment, sys_tablespace_auto_extend_increment, PLUGIN_VAR_RQCMDARG, "Data file autoextend increment in megabytes", - NULL, NULL, 64L, 1L, 1000L, 0); + NULL, NULL, 64, 1, 1000, 0); /** Validate the requested buffer pool size. Also, reserve the necessary memory needed for buffer pool resize. @@ -19808,15 +19796,15 @@ static MYSQL_SYSVAR_UINT(data_file_size_debug, "InnoDB system tablespace size to be set in recovery.", NULL, NULL, 0, 0, 256U << 20, 0); -static MYSQL_SYSVAR_ULONG(fil_make_page_dirty_debug, +static MYSQL_SYSVAR_UINT(fil_make_page_dirty_debug, srv_fil_make_page_dirty_debug, PLUGIN_VAR_OPCMDARG, "Make the first page of the given tablespace dirty.", NULL, innodb_make_page_dirty, 0, 0, UINT_MAX32, 0); -static MYSQL_SYSVAR_ULONG(saved_page_number_debug, +static MYSQL_SYSVAR_UINT(saved_page_number_debug, srv_saved_page_number_debug, PLUGIN_VAR_OPCMDARG, "An InnoDB page number.", - NULL, innodb_save_page_no, 0, 0, UINT_MAX32, 0); + NULL, NULL, 0, 0, UINT_MAX32, 0); static MYSQL_SYSVAR_BOOL(disable_resize_buffer_pool_debug, buf_disable_resize_buffer_pool_debug, PLUGIN_VAR_NOCMDARG, diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 84003fb415c..494ae2798ee 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -662,10 +662,11 @@ ibuf_bitmap_page_set_bits( @return the bitmap page id where the file page is mapped */ inline page_id_t ibuf_bitmap_page_no_calc(const page_id_t page_id, ulint size) { - if (!size) size = srv_page_size; + if (!size) + size= srv_page_size; - return page_id_t(page_id.space(), FSP_IBUF_BITMAP_OFFSET - + (page_id.page_no() & ~(size - 1))); + return page_id_t(page_id.space(), FSP_IBUF_BITMAP_OFFSET + + uint32_t(page_id.page_no() & ~(size - 1))); } /** Gets the ibuf bitmap page where the bits describing a given file page are @@ -1034,7 +1035,7 @@ ibuf_page_low( Returns the page number field of an ibuf record. @return page number */ static -ulint +uint32_t ibuf_rec_get_page_no_func( /*======================*/ #ifdef UNIV_DEBUG @@ -1072,7 +1073,7 @@ Returns the space id field of an ibuf record. For < 4.1.x format records returns 0. @return space id */ static -ulint +uint32_t ibuf_rec_get_space_func( /*====================*/ #ifdef UNIV_DEBUG @@ -1900,7 +1901,6 @@ ibuf_remove_free_page(void) mtr_t mtr; mtr_t mtr2; page_t* header_page; - ulint page_no; log_free_check(); @@ -1932,8 +1932,8 @@ ibuf_remove_free_page(void) mutex_exit(&ibuf_mutex); - page_no = flst_get_last(PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST - + root->frame).page; + uint32_t page_no = flst_get_last(PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST + + root->frame).page; /* NOTE that we must release the latch on the ibuf tree root because in fseg_free_page we access level 1 pages, and the root @@ -2042,19 +2042,19 @@ ibuf_get_merge_page_nos_func( #ifdef UNIV_DEBUG mtr_t* mtr, /*!< in: mini-transaction holding rec */ #endif /* UNIV_DEBUG */ - ulint* space_ids,/*!< in/out: space id's of the pages */ - ulint* page_nos,/*!< in/out: buffer for at least + uint32_t* space_ids,/*!< in/out: space id's of the pages */ + uint32_t* page_nos,/*!< in/out: buffer for at least IBUF_MAX_N_PAGES_MERGED many page numbers; the page numbers are in an ascending order */ ulint* n_stored)/*!< out: number of page numbers stored to page_nos in this function */ { - ulint prev_page_no; - ulint prev_space_id; - ulint first_page_no; - ulint first_space_id; - ulint rec_page_no; - ulint rec_space_id; + uint32_t prev_page_no; + uint32_t prev_space_id; + uint32_t first_page_no; + uint32_t first_space_id; + uint32_t rec_page_no; + uint32_t rec_space_id; ulint sum_volumes; ulint volume_for_page; ulint rec_volume; @@ -2247,25 +2247,23 @@ ulint ibuf_get_merge_pages( /*=================*/ btr_pcur_t* pcur, /*!< in/out: cursor */ - ulint space, /*!< in: space for which to merge */ + uint32_t space, /*!< in: space for which to merge */ ulint limit, /*!< in: max page numbers to read */ - ulint* pages, /*!< out: pages read */ - ulint* spaces, /*!< out: spaces read */ + uint32_t* pages, /*!< out: pages read */ + uint32_t* spaces, /*!< out: spaces read */ ulint* n_pages,/*!< out: number of pages read */ mtr_t* mtr) /*!< in: mini transaction */ { const rec_t* rec; ulint volume = 0; - ut_a(space != ULINT_UNDEFINED); - *n_pages = 0; while ((rec = ibuf_get_user_rec(pcur, mtr)) != 0 && ibuf_rec_get_space(mtr, rec) == space && *n_pages < limit) { - ulint page_no = ibuf_rec_get_page_no(mtr, rec); + uint32_t page_no = ibuf_rec_get_page_no(mtr, rec); if (*n_pages == 0 || pages[*n_pages - 1] != page_no) { spaces[*n_pages] = space; @@ -2283,19 +2281,18 @@ ibuf_get_merge_pages( /** Delete a change buffer record. -@param[in] space tablespace identifier -@param[in] page_no page number +@param[in] page_id page identifier @param[in,out] pcur persistent cursor positioned on the record @param[in] search_tuple search key for (space,page_no) @param[in,out] mtr mini-transaction @return whether mtr was committed (due to pessimistic operation) */ static MY_ATTRIBUTE((warn_unused_result, nonnull)) -bool ibuf_delete_rec(ulint space, ulint page_no, btr_pcur_t* pcur, +bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, const dtuple_t* search_tuple, mtr_t* mtr); /** Merge the change buffer to some pages. */ -static void ibuf_read_merge_pages(const ulint* space_ids, - const ulint* page_nos, ulint n_stored) +static void ibuf_read_merge_pages(const uint32_t* space_ids, + const uint32_t* page_nos, ulint n_stored) { mem_heap_t* heap = mem_heap_create(512); ulint dops[IBUF_OP_COUNT]; @@ -2359,7 +2356,7 @@ loop: dops[ibuf_rec_get_op_type(&mtr, ibuf_rec)]++; /* Delete the record from ibuf */ - if (ibuf_delete_rec(space_id, page_nos[i], + if (ibuf_delete_rec(page_id_t(space_id, page_nos[i]), &pcur, tuple, &mtr)) { /* Deletion was pessimistic and mtr was committed: we start from the @@ -2398,8 +2395,8 @@ ibuf_merge_pages( mtr_t mtr; btr_pcur_t pcur; ulint sum_sizes; - ulint page_nos[IBUF_MAX_N_PAGES_MERGED]; - ulint space_ids[IBUF_MAX_N_PAGES_MERGED]; + uint32_t page_nos[IBUF_MAX_N_PAGES_MERGED]; + uint32_t space_ids[IBUF_MAX_N_PAGES_MERGED]; *n_pages = 0; @@ -2472,8 +2469,8 @@ ibuf_merge_space( ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index)); ulint sum_sizes = 0; - ulint pages[IBUF_MAX_N_PAGES_MERGED]; - ulint spaces[IBUF_MAX_N_PAGES_MERGED]; + uint32_t pages[IBUF_MAX_N_PAGES_MERGED]; + uint32_t spaces[IBUF_MAX_N_PAGES_MERGED]; if (page_is_empty(btr_pcur_get_page(&pcur))) { /* If a B-tree page is empty, it must be the root page @@ -2485,7 +2482,7 @@ ibuf_merge_space( } else { sum_sizes = ibuf_get_merge_pages( - &pcur, space, IBUF_MAX_N_PAGES_MERGED, + &pcur, uint32_t(space), IBUF_MAX_N_PAGES_MERGED, &pages[0], &spaces[0], &n_pages, &mtr); ib::info() << "Size of pages merged " << sum_sizes; @@ -2789,9 +2786,7 @@ ibuf_get_volume_buffered( ulint volume; const rec_t* rec; const page_t* page; - ulint prev_page_no; const page_t* prev_page; - ulint next_page_no; const page_t* next_page; /* bitmap of buffered recs */ ulint hash_bitmap[128 / sizeof(ulint)]; @@ -2816,6 +2811,8 @@ ibuf_get_volume_buffered( rec = page_rec_get_prev_const(rec); } + uint32_t prev_page_no; + for (; !page_rec_is_infimum(rec); rec = page_rec_get_prev_const(rec)) { ut_ad(page_align(rec) == page); @@ -2908,7 +2905,7 @@ count_later: /* Look at the next page */ - next_page_no = btr_page_get_next(page); + uint32_t next_page_no = btr_page_get_next(page); if (next_page_no == FIL_NULL) { @@ -3196,8 +3193,8 @@ ibuf_insert_low( page_t* root; dberr_t err; ibool do_merge; - ulint space_ids[IBUF_MAX_N_PAGES_MERGED]; - ulint page_nos[IBUF_MAX_N_PAGES_MERGED]; + uint32_t space_ids[IBUF_MAX_N_PAGES_MERGED]; + uint32_t page_nos[IBUF_MAX_N_PAGES_MERGED]; ulint n_stored; mtr_t mtr; mtr_t bitmap_mtr; @@ -4011,14 +4008,12 @@ ibuf_delete( /*********************************************************************//** Restores insert buffer tree cursor position -@return TRUE if the position was restored; FALSE if not */ +@return whether the position was restored */ static MY_ATTRIBUTE((nonnull)) -ibool +bool ibuf_restore_pos( /*=============*/ - ulint space, /*!< in: space id */ - ulint page_no,/*!< in: index page number where the record - should belong */ + const page_id_t page_id,/*!< in: page identifier */ const dtuple_t* search_tuple, /*!< in: search tuple for entries of page_no */ ulint mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */ @@ -4029,15 +4024,14 @@ ibuf_restore_pos( ut_ad(mode == BTR_MODIFY_LEAF || BTR_LATCH_MODE_WITHOUT_INTENTION(mode) == BTR_MODIFY_TREE); - if (btr_pcur_restore_position(mode, pcur, mtr)) { - - return(TRUE); + if (UNIV_LIKELY(btr_pcur_restore_position(mode, pcur, mtr))) { + return true; } - if (fil_space_t* s = fil_space_acquire_silent(space)) { + if (fil_space_t* s = fil_space_acquire_silent(page_id.space())) { ib::error() << "ibuf cursor restoration fails!" " ibuf record inserted to page " - << space << ":" << page_no + << page_id << " in file " << s->chain.start->name; s->release(); @@ -4052,19 +4046,18 @@ ibuf_restore_pos( } ibuf_btr_pcur_commit_specify_mtr(pcur, mtr); - return(FALSE); + return false; } /** Delete a change buffer record. -@param[in] space tablespace identifier -@param[in] page_no page number +@param[in] page_id page identifier @param[in,out] pcur persistent cursor positioned on the record @param[in] search_tuple search key for (space,page_no) @param[in,out] mtr mini-transaction @return whether mtr was committed (due to pessimistic operation) */ static MY_ATTRIBUTE((warn_unused_result, nonnull)) -bool ibuf_delete_rec(ulint space, ulint page_no, btr_pcur_t* pcur, +bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, const dtuple_t* search_tuple, mtr_t* mtr) { ibool success; @@ -4073,14 +4066,14 @@ bool ibuf_delete_rec(ulint space, ulint page_no, btr_pcur_t* pcur, ut_ad(ibuf_inside(mtr)); ut_ad(page_rec_is_user_rec(btr_pcur_get_rec(pcur))); - ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no); - ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space); + ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) + == page_id.page_no()); + ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) + == page_id.space()); success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), 0, mtr); - const page_id_t page_id(space, page_no); - if (success) { if (page_is_empty(btr_pcur_get_page(pcur))) { /* If a B-tree page is empty, it must be the root page @@ -4101,10 +4094,6 @@ bool ibuf_delete_rec(ulint space, ulint page_no, btr_pcur_t* pcur, return(FALSE); } - ut_ad(page_rec_is_user_rec(btr_pcur_get_rec(pcur))); - ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no); - ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space); - /* We have to resort to a pessimistic delete from ibuf. Delete-mark the record so that it will not be applied again, in case the server crashes before the pessimistic delete is @@ -4118,7 +4107,7 @@ bool ibuf_delete_rec(ulint space, ulint page_no, btr_pcur_t* pcur, ibuf_mtr_start(mtr); mutex_enter(&ibuf_mutex); - if (!ibuf_restore_pos(space, page_no, search_tuple, + if (!ibuf_restore_pos(page_id, search_tuple, BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, pcur, mtr)) { @@ -4440,9 +4429,7 @@ loop: buf_block_dbg_add_level( block, SYNC_IBUF_TREE_NODE); - if (!ibuf_restore_pos(page_id.space(), - page_id.page_no(), - search_tuple, + if (!ibuf_restore_pos(page_id, search_tuple, BTR_MODIFY_LEAF, &pcur, &mtr)) { @@ -4465,8 +4452,7 @@ loop: } /* Delete the record from ibuf */ - if (ibuf_delete_rec(page_id.space(), page_id.page_no(), - &pcur, search_tuple, &mtr)) { + if (ibuf_delete_rec(page_id, &pcur, search_tuple, &mtr)) { /* Deletion was pessimistic and mtr was committed: we start from the beginning again */ @@ -4518,7 +4504,6 @@ void ibuf_delete_for_discarded_space(ulint space) btr_pcur_t pcur; dtuple_t* search_tuple; const rec_t* ibuf_rec; - ulint page_no; mtr_t mtr; /* Counts for discarded operations. */ @@ -4557,13 +4542,13 @@ loop: goto leave_loop; } - page_no = ibuf_rec_get_page_no(&mtr, ibuf_rec); + uint32_t page_no = ibuf_rec_get_page_no(&mtr, ibuf_rec); dops[ibuf_rec_get_op_type(&mtr, ibuf_rec)]++; /* Delete the record from ibuf */ - if (ibuf_delete_rec(space, page_no, &pcur, search_tuple, - &mtr)) { + if (ibuf_delete_rec(page_id_t(space, page_no), + &pcur, search_tuple, &mtr)) { /* Deletion was pessimistic and mtr was committed: we start from the beginning again */ @@ -4641,19 +4626,18 @@ ibuf_print( @return DB_SUCCESS or error code */ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) { - ulint page_no; ut_ad(trx->mysql_thd); ut_ad(space->purpose == FIL_TYPE_IMPORT); - const ulint zip_size = space->zip_size(); - const ulint physical_size = space->physical_size(); + const unsigned zip_size = space->zip_size(); + const unsigned physical_size = space->physical_size(); /* fil_space_t::size and fil_space_t::free_limit would still be 0 at this point. So, we will have to read page 0. */ ut_ad(!space->free_limit); ut_ad(!space->size); - mtr_t mtr; - ulint size; + mtr_t mtr; + uint32_t size; mtr.start(); if (buf_block_t* sp = buf_page_get(page_id_t(space->id, 0), zip_size, @@ -4668,10 +4652,6 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) } mtr.commit(); - if (size == 0) { - return(DB_TABLE_NOT_FOUND); - } - mutex_enter(&ibuf_mutex); /* The two bitmap pages (allocation bitmap and ibuf bitmap) repeat @@ -4680,7 +4660,7 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) below page_no is measured in number of pages since the beginning of the space, as usual. */ - for (page_no = 0; page_no < size; page_no += physical_size) { + for (uint32_t page_no = 0; page_no < size; page_no += physical_size) { if (trx_is_interrupted(trx)) { mutex_exit(&ibuf_mutex); return(DB_INTERRUPTED); @@ -4706,7 +4686,7 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) ibuf bitmap page. The subsequent page should be all-zero pages. */ #ifdef UNIV_DEBUG - for (ulint curr_page = page_no + 1; + for (uint32_t curr_page = page_no + 1; curr_page < physical_size; curr_page++) { buf_block_t* block = buf_page_get( @@ -4723,9 +4703,9 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) continue; } - for (ulint i = FSP_IBUF_BITMAP_OFFSET + 1; i < physical_size; + for (uint32_t i = FSP_IBUF_BITMAP_OFFSET + 1; i < physical_size; i++) { - const ulint offset = page_no + i; + const uint32_t offset = page_no + i; const page_id_t cur_page_id(space->id, offset); if (ibuf_bitmap_page_get_bits( @@ -4739,7 +4719,7 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) ib_errf(trx->mysql_thd, IB_LOG_LEVEL_ERROR, ER_INNODB_INDEX_CORRUPT, - "File %s page " ULINTPF + "File %s page %u" " is wrongly flagged to belong to the" " insert buffer", space->chain.start->name, offset); @@ -4754,8 +4734,7 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) IB_LOG_LEVEL_WARN, ER_INNODB_INDEX_CORRUPT, "Buffered changes" - " for file %s page " ULINTPF - " are lost", + " for file %s page %u are lost", space->chain.start->name, offset); /* Tolerate this error, so that diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index b02c65f3a31..317c63c97d8 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -227,8 +227,8 @@ btr_height_get( @param[in] line line where called @param[in,out] mtr mini-transaction @return block */ -inline buf_block_t* btr_block_get_func(const dict_index_t& index, ulint page, - ulint mode, bool merge, +inline buf_block_t* btr_block_get_func(const dict_index_t& index, + uint32_t page, ulint mode, bool merge, const char* file, unsigned line, mtr_t* mtr) { @@ -323,7 +323,7 @@ the child page number. In other words offsets must have been retrieved with rec_get_offsets(n_fields=ULINT_UNDEFINED). @return child node address */ UNIV_INLINE -ulint +uint32_t btr_node_ptr_get_child_page_no( /*===========================*/ const rec_t* rec, /*!< in: node pointer record */ @@ -607,7 +607,7 @@ buf_block_t* btr_page_alloc( /*===========*/ dict_index_t* index, /*!< in: index tree */ - ulint hint_page_no, /*!< in: hint of a good page */ + uint32_t hint_page_no, /*!< in: hint of a good page */ byte file_direction, /*!< in: direction where a possible page split is made */ ulint level, /*!< in: level where the page is placed diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index 5d2faa1e298..89826e8f214 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -90,7 +90,7 @@ the child page number. In other words offsets must have been retrieved with rec_get_offsets(n_fields=ULINT_UNDEFINED). @return child node address */ UNIV_INLINE -ulint +uint32_t btr_node_ptr_get_child_page_no( /*===========================*/ const rec_t* rec, /*!< in: node pointer record */ @@ -98,7 +98,6 @@ btr_node_ptr_get_child_page_no( { const byte* field; ulint len; - ulint page_no; ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec)); @@ -108,7 +107,7 @@ btr_node_ptr_get_child_page_no( ut_ad(len == 4); - page_no = mach_read_from_4(field); + uint32_t page_no = mach_read_from_4(field); ut_ad(page_no > 1); return(page_no); diff --git a/storage/innobase/include/btr0bulk.h b/storage/innobase/include/btr0bulk.h index dc28d15b391..375b7b34fe4 100644 --- a/storage/innobase/include/btr0bulk.h +++ b/storage/innobase/include/btr0bulk.h @@ -57,7 +57,7 @@ public: PageBulk( dict_index_t* index, trx_id_t trx_id, - ulint page_no, + uint32_t page_no, ulint level) : m_heap(NULL), @@ -179,10 +179,7 @@ public: inline bool isSpaceAvailable(ulint rec_size); /** Get page no */ - ulint getPageNo() - { - return(m_page_no); - } + uint32_t getPageNo() const { return m_page_no; } /** Get page level */ ulint getLevel() @@ -241,7 +238,7 @@ private: rec_t* m_cur_rec; /** The page no */ - ulint m_page_no; + uint32_t m_page_no; /** The page level in B-tree */ ulint m_level; diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 03ebf6f448f..838b49dad47 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -799,7 +799,7 @@ struct btr_path_t { ulint n_recs; /** Number of the page containing the record. */ - ulint page_no; + uint32_t page_no; /** Level of the page. If later we fetch the page under page_no and it is no different level then we know that the tree has been diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h index f4d1560862a..e111bbd7a02 100644 --- a/storage/innobase/include/buf0rea.h +++ b/storage/innobase/include/buf0rea.h @@ -106,14 +106,9 @@ for the highest address page to get read in, before this function returns @param[in] space_id tablespace id @param[in] page_nos array of page numbers to read, with the highest page number the last in the array -@param[in] n_stored number of page numbers in the array */ - -void -buf_read_recv_pages( - bool sync, - ulint space_id, - const ulint* page_nos, - ulint n_stored); +@param[in] n number of page numbers in the array */ +void buf_read_recv_pages(bool sync, ulint space_id, const uint32_t *page_nos, + ulint n); /** @name Modes used in read-ahead @{ */ /** read only pages belonging to the insert buffer tree */ diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h index b50352a1c0b..ba1e2e5eaa6 100644 --- a/storage/innobase/include/buf0types.h +++ b/storage/innobase/include/buf0types.h @@ -122,10 +122,9 @@ public: /** Constructor from (space, page_no). @param[in] space tablespace id @param[in] page_no page number */ - page_id_t(ulint space, ulint page_no) : m_id(uint64_t{space} << 32 | page_no) + page_id_t(ulint space, uint32_t page_no) : m_id(uint64_t{space} << 32 | page_no) { ut_ad(space <= 0xFFFFFFFFU); - ut_ad(page_no <= 0xFFFFFFFFU); } page_id_t(uint64_t id) : m_id(id) {} @@ -167,9 +166,8 @@ public: /** Reset the page number only. @param[in] page_no page number */ - void set_page_no(ulint page_no) + void set_page_no(uint32_t page_no) { - ut_ad(page_no <= 0xFFFFFFFFU); m_id= (m_id & ~uint64_t{0} << 32) | page_no; } diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h index 62714b88679..49567a49a78 100644 --- a/storage/innobase/include/fil0crypt.h +++ b/storage/innobase/include/fil0crypt.h @@ -85,8 +85,8 @@ struct fil_space_rotate_state_t { time_t start_time; /*!< time when rotation started */ ulint active_threads; /*!< active threads in space */ - ulint next_offset; /*!< next "free" offset */ - ulint max_offset; /*!< max offset needing to be rotated */ + uint32_t next_offset; /*!< next "free" offset */ + uint32_t max_offset; /*!< max offset needing to be rotated */ uint min_key_version_found; /*!< min key version found but not rotated */ lsn_t end_lsn; /*!< max lsn created when rotating this diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index b6ff8b6b6bb..0fa0c0b598b 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -335,21 +335,21 @@ struct fil_space_t fil_type_t purpose;/*!< purpose */ UT_LIST_BASE_NODE_T(fil_node_t) chain; /*!< base node for the file chain */ - ulint size; /*!< tablespace file size in pages; + uint32_t size; /*!< tablespace file size in pages; 0 if not known yet */ - ulint size_in_header; + uint32_t size_in_header; /* FSP_SIZE in the tablespace header; 0 if not known yet */ - ulint free_len; + uint32_t free_len; /*!< length of the FSP_FREE list */ - ulint free_limit; + uint32_t free_limit; /*!< contents of FSP_FREE_LIMIT */ - ulint recv_size; + uint32_t recv_size; /*!< recovered tablespace size in pages; 0 if no size change was read from the redo log, or if the size change was implemented */ /** the committed size of the tablespace in pages */ - Atomic_relaxed<ulint> committed_size; + Atomic_relaxed<uint32_t> committed_size; ulint n_reserved_extents; /*!< number of reserved free extents for ongoing operations like B-tree page split */ @@ -370,7 +370,7 @@ private: /** Flag in n_pending_ops that indicates that the tablespace is being deleted, and no further operations should be performed */ - static const size_t STOP_NEW_OPS= ~(~size_t(0) >> 1); + static constexpr uint32_t STOP_NEW_OPS= ~(~uint32_t(0) >> 1); public: /** Number of pending block read or write operations (when a write is imminent or a read has recently completed). @@ -429,11 +429,11 @@ public: @param[in] is_raw whether this is a raw device @param[in] atomic_write true if atomic write could be enabled @param[in] max_pages maximum number of pages in file, - or ULINT_MAX for unlimited + or UINT32_MAX for unlimited @return file object */ fil_node_t* add(const char* name, pfs_os_file_t handle, - ulint size, bool is_raw, bool atomic_write, - ulint max_pages = ULINT_MAX); + uint32_t size, bool is_raw, bool atomic_write, + uint32_t max_pages = UINT32_MAX); #ifdef UNIV_DEBUG /** Assert that the mini-transaction is compatible with updating an allocation bitmap page. @@ -886,18 +886,18 @@ struct fil_node_t { /** size of the file in database pages (0 if not known yet); the possible last incomplete megabyte may be ignored if space->id == 0 */ - ulint size; + uint32_t size; /** initial size of the file in database pages; FIL_IBD_FILE_INITIAL_SIZE by default */ - ulint init_size; + uint32_t init_size; /** maximum size of the file in database pages (0 if unlimited) */ - ulint max_size; + uint32_t max_size; /** count of pending i/o's; is_open must be true if nonzero */ ulint n_pending; /** count of pending flushes; is_open must be true if nonzero */ ulint n_pending_flushes; /** whether the file is currently being extended */ - bool being_extended; + Atomic_relaxed<bool> being_extended; /** whether this file had writes after lasy fsync() */ bool needs_flush; /** link to other files in this tablespace */ @@ -962,8 +962,8 @@ inline void fil_space_t::set_imported() inline bool fil_space_t::is_rotational() const { - for (const fil_node_t* node = UT_LIST_GET_FIRST(chain); - node != NULL; node = UT_LIST_GET_NEXT(chain, node)) { + for (const fil_node_t* node = UT_LIST_GET_FIRST(chain); node; + node = UT_LIST_GET_NEXT(chain, node)) { if (!node->on_ssd) { return true; } @@ -1379,7 +1379,7 @@ Error messages are issued to the server log. @param[in] id tablespace identifier @param[in] flags tablespace flags @param[in] purpose tablespace purpose -@param[in,out] crypt_data encryption information +@param[in,out] crypt_data encryption information @param[in] mode encryption mode @return pointer to created tablespace, to be filled in with fil_space_t::add() @retval NULL on failure (such as when the same tablespace exists) */ @@ -1418,8 +1418,8 @@ fil_space_free( @param id tablespace ID @param size recovered size in pages @param flags tablespace flags */ -UNIV_INTERN -void fil_space_set_recv_size_and_flags(ulint id, ulint size, uint32_t flags); +void fil_space_set_recv_size_and_flags(ulint id, uint32_t size, + uint32_t flags); /*******************************************************************//** Returns the size of the space in pages. The tablespace must be cached in the @@ -1576,7 +1576,7 @@ fil_ibd_create( const char* name, const char* path, ulint flags, - ulint size, + uint32_t size, fil_encryption_t mode, uint32_t key_id, dberr_t* err) @@ -1688,10 +1688,7 @@ fil_space_for_table_exists_in_mem( @param[in,out] space tablespace @param[in] size desired size in pages @return whether the tablespace is at least as big as requested */ -bool -fil_space_extend( - fil_space_t* space, - ulint size); +bool fil_space_extend(fil_space_t *space, uint32_t size); struct fil_io_t { diff --git a/storage/innobase/include/fsp0file.h b/storage/innobase/include/fsp0file.h index 759970bb46d..7a0687d4960 100644 --- a/storage/innobase/include/fsp0file.h +++ b/storage/innobase/include/fsp0file.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 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 @@ -68,7 +68,7 @@ public: /* No op */ } - Datafile(const char* name, ulint flags, ulint size, ulint order) + Datafile(const char* name, ulint flags, uint32_t size, ulint order) : m_name(mem_strdup(name)), m_filepath(), @@ -431,7 +431,7 @@ private: /** size in megabytes or pages; converted from megabytes to pages in SysTablespace::normalize_size() */ - ulint m_size; + uint32_t m_size; /** ordinal position of this datafile in the tablespace */ ulint m_order; diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 31c66cb57ea..308b0916284 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -316,11 +316,9 @@ inline uint32_t fsp_header_get_field(const page_t* page, ulint field) /** Read the flags from the tablespace header page. @param[in] page first page of a tablespace @return the contents of FSP_SPACE_FLAGS */ -inline -ulint -fsp_header_get_flags(const page_t* page) +inline uint32_t fsp_header_get_flags(const page_t *page) { - return(fsp_header_get_field(page, FSP_SPACE_FLAGS)); + return fsp_header_get_field(page, FSP_SPACE_FLAGS); } /** Get the byte offset of encryption information in page 0. @@ -359,7 +357,7 @@ fsp_header_init_fields( @param[in,out] space tablespace @param[in] size current size in blocks @param[in,out] mtr mini-transaction */ -void fsp_header_init(fil_space_t* space, ulint size, mtr_t* mtr) +void fsp_header_init(fil_space_t* space, uint32_t size, mtr_t* mtr) MY_ATTRIBUTE((nonnull)); /** Create a new segment. @@ -411,7 +409,7 @@ buf_block_t* fseg_alloc_free_page_general( /*=========================*/ fseg_header_t* seg_header,/*!< in/out: segment header */ - ulint hint, /*!< in: hint of which page would be + uint32_t hint, /*!< in: hint of which page would be desirable */ byte direction,/*!< in: if the new page is needed because of an index page split, and records are @@ -473,7 +471,7 @@ fsp_reserve_free_extents( ulint n_ext, fsp_reserve_t alloc_type, mtr_t* mtr, - ulint n_pages = 2); + uint32_t n_pages = 2); /** Free a page in a file segment. @param[in,out] seg_header file segment header @@ -484,7 +482,7 @@ void fseg_free_page( fseg_header_t* seg_header, fil_space_t* space, - ulint offset, + uint32_t offset, mtr_t* mtr); /** Determine whether a page is free. @param[in,out] space tablespace @@ -736,7 +734,7 @@ inline ulint xdes_calc_descriptor_index(ulint zip_size, ulint offset) @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] offset page offset @return descriptor page offset */ -inline ulint xdes_calc_descriptor_page(ulint zip_size, ulint offset) +inline uint32_t xdes_calc_descriptor_page(ulint zip_size, uint32_t offset) { compile_time_assert(UNIV_PAGE_SIZE_MAX > XDES_ARR_OFFSET + (UNIV_PAGE_SIZE_MAX / FSP_EXTENT_SIZE_MAX) @@ -754,8 +752,8 @@ inline ulint xdes_calc_descriptor_page(ulint zip_size, ulint offset) ut_ad(!zip_size || zip_size > XDES_ARR_OFFSET + (zip_size / FSP_EXTENT_SIZE) * XDES_SIZE); - return ut_2pow_round<ulint>(offset, - zip_size ? zip_size : srv_page_size); + return ut_2pow_round(offset, + uint32_t(zip_size ? zip_size : srv_page_size)); } #endif /* UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/fsp0space.h b/storage/innobase/include/fsp0space.h index 632c65e14cc..c00c8d689bf 100644 --- a/storage/innobase/include/fsp0space.h +++ b/storage/innobase/include/fsp0space.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 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 @@ -163,9 +163,9 @@ public: void shutdown(); /** @return the sum of the file sizes of each Datafile */ - ulint get_sum_of_sizes() const + uint32_t get_sum_of_sizes() const { - ulint sum = 0; + uint32_t sum = 0; for (const_iterator it = begin(); it != end(); ++it) { sum += it->m_size; diff --git a/storage/innobase/include/fsp0sysspace.h b/storage/innobase/include/fsp0sysspace.h index bcb8dd5e5e9..2e0a395f71c 100644 --- a/storage/innobase/include/fsp0sysspace.h +++ b/storage/innobase/include/fsp0sysspace.h @@ -30,7 +30,7 @@ Created 2013-7-26 by Kevin Lewis /** If the last data file is auto-extended, we add this many pages to it at a time. We have to make this public because it is a config variable. */ -extern ulong sys_tablespace_auto_extend_increment; +extern uint sys_tablespace_auto_extend_increment; /** Data structure that contains the information about shared tablespaces. Currently this can be the system tablespace or a temporary table tablespace */ @@ -120,7 +120,7 @@ public: /** Set the last file size. @param[in] size the size to set */ - void set_last_file_size(ulint size) + void set_last_file_size(uint32_t size) { ut_ad(!m_files.empty()); m_files.back().m_size = size; @@ -128,7 +128,7 @@ public: /** Get the size of the last data file in the tablespace @return the size of the last data file in the array */ - ulint last_file_size() const + uint32_t last_file_size() const { ut_ad(!m_files.empty()); return(m_files.back().m_size); @@ -136,7 +136,7 @@ public: /** @return the autoextend increment in pages. */ - ulint get_autoextend_increment() const + uint32_t get_autoextend_increment() const { return sys_tablespace_auto_extend_increment << (20 - srv_page_size_shift); @@ -144,7 +144,7 @@ public: /** @return next increment size */ - ulint get_increment() const; + uint32_t get_increment() const; /** Open or create the data files @param[in] is_temp whether this is a temporary tablespace @@ -240,8 +240,7 @@ private: /** if true, then we auto-extend the last data file */ bool m_auto_extend_last_file; - /** if != 0, this tells the max size auto-extending may increase the - last data file size */ + /** maximum size of the last data file (0=unlimited) */ ulint m_last_file_size_max; /** If the following is true we do not allow diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h index f064df01679..f7a2d6cd4cd 100644 --- a/storage/innobase/include/gis0rtree.h +++ b/storage/innobase/include/gis0rtree.h @@ -169,10 +169,10 @@ void rtr_non_leaf_stack_push( /*====================*/ rtr_node_path_t* path, /*!< in/out: search path */ - ulint pageno, /*!< in: pageno to insert */ + uint32_t pageno, /*!< in: pageno to insert */ node_seq_t seq_no, /*!< in: Node sequence num */ ulint level, /*!< in: index level */ - ulint child_no, /*!< in: child page no */ + uint32_t child_no, /*!< in: child page no */ btr_pcur_t* cursor, /*!< in: position cursor */ double mbr_inc); /*!< in: MBR needs to be enlarged */ diff --git a/storage/innobase/include/gis0rtree.ic b/storage/innobase/include/gis0rtree.ic index 2076b24b9b1..82747bdc95a 100644 --- a/storage/innobase/include/gis0rtree.ic +++ b/storage/innobase/include/gis0rtree.ic @@ -96,10 +96,10 @@ void rtr_non_leaf_stack_push( /*====================*/ rtr_node_path_t* path, /*!< in/out: search path */ - ulint pageno, /*!< in: pageno to insert */ + uint32_t pageno, /*!< in: pageno to insert */ node_seq_t seq_no, /*!< in: Node sequence num */ ulint level, /*!< in: index page level */ - ulint child_no, /*!< in: child page no */ + uint32_t child_no, /*!< in: child page no */ btr_pcur_t* cursor, /*!< in: position cursor */ double mbr_inc) /*!< in: MBR needs to be enlarged */ diff --git a/storage/innobase/include/gis0type.h b/storage/innobase/include/gis0type.h index a1e0a878cb2..55944bfcce3 100644 --- a/storage/innobase/include/gis0type.h +++ b/storage/innobase/include/gis0type.h @@ -37,15 +37,15 @@ Created 2013/03/27 Jimmy Yang #include <vector> #include <forward_list> -/* Node Sequence Number. Only updated when page splits */ -typedef ib_uint32_t node_seq_t; +/** Node Sequence Number. Only updated when page splits */ +typedef uint32_t node_seq_t; /* RTree internal non-leaf Nodes to be searched, from root to leaf */ -typedef struct node_visit { - ulint page_no; /*!< the page number */ +struct node_visit_t { + uint32_t page_no; /*!< the page number */ node_seq_t seq_no; /*!< the SSN (split sequence number */ ulint level; /*!< the page's index level */ - ulint child_no; /*!< child page num if for parent + uint32_t child_no; /*!< child page num if for parent recording */ btr_pcur_t* cursor; /*!< cursor structure if we positioned FIXME: there is no need to use whole @@ -53,7 +53,7 @@ typedef struct node_visit { members */ double mbr_inc; /*!< whether this node needs to be enlarged for insertion */ -} node_visit_t; +}; typedef std::vector<node_visit_t, ut_allocator<node_visit_t> > rtr_node_path_t; diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 2aae5ed6989..a73b9e48755 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -568,7 +568,7 @@ page_get_middle_rec( Gets the page number. @return page number */ UNIV_INLINE -ulint +uint32_t page_get_page_no( /*=============*/ const page_t* page); /*!< in: page */ @@ -577,7 +577,7 @@ page_get_page_no( Gets the tablespace identifier. @return space id */ UNIV_INLINE -ulint +uint32_t page_get_space_id( /*==============*/ const page_t* page); /*!< in: page */ diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index ad6fac32b69..2de2ad38080 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -300,7 +300,7 @@ page_get_middle_rec( Gets the page number. @return page number */ UNIV_INLINE -ulint +uint32_t page_get_page_no( /*=============*/ const page_t* page) /*!< in: page */ @@ -314,7 +314,7 @@ page_get_page_no( Gets the tablespace identifier. @return space id */ UNIV_INLINE -ulint +uint32_t page_get_space_id( /*==============*/ const page_t* page) /*!< in: page */ diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index 937e05dfba6..a3ccc90b630 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -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 @@ -37,7 +37,7 @@ Created 3/26/1996 Heikki Tuuri @return rollback segment header, page x-latched */ UNIV_INLINE buf_block_t* -trx_rsegf_get(fil_space_t* space, ulint page_no, mtr_t* mtr); +trx_rsegf_get(fil_space_t* space, uint32_t page_no, mtr_t* mtr); /** Gets a newly created rollback segment header. @param[in] space space where placed @@ -48,7 +48,7 @@ UNIV_INLINE buf_block_t* trx_rsegf_get_new( ulint space, - ulint page_no, + uint32_t page_no, mtr_t* mtr); /** Create a rollback segment header. @@ -106,10 +106,10 @@ struct trx_rseg_t { fil_space_t* space; /** page number of the rollback segment header */ - ulint page_no; + uint32_t page_no; /** current size in pages */ - ulint curr_size; + uint32_t curr_size; /*--------------------------------------------------------*/ /* Fields for undo logs */ diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.ic index e0e8c175a5d..b293d9f1ae1 100644 --- a/storage/innobase/include/trx0rseg.ic +++ b/storage/innobase/include/trx0rseg.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2013, 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 @@ -34,7 +34,7 @@ Created 3/26/1996 Heikki Tuuri @return rollback segment header, page x-latched */ UNIV_INLINE buf_block_t* -trx_rsegf_get(fil_space_t* space, ulint page_no, mtr_t* mtr) +trx_rsegf_get(fil_space_t* space, uint32_t page_no, mtr_t* mtr) { ut_ad(space == fil_system.sys_space || space == fil_system.temp_space || srv_is_undo_tablespace(space->id) @@ -56,7 +56,7 @@ UNIV_INLINE buf_block_t* trx_rsegf_get_new( ulint space, - ulint page_no, + uint32_t page_no, mtr_t* mtr) { buf_block_t* block; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 11c57618e53..e241c849c4e 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -535,7 +535,7 @@ struct file_name_t { fil_status status; /** FSP_SIZE of tablespace */ - ulint size = 0; + uint32_t size = 0; /** Freed pages of tablespace */ range_set freed_ranges; @@ -2467,12 +2467,12 @@ page number. @param[in] page_id page id */ static void recv_read_in_area(page_id_t page_id) { - ulint page_nos[RECV_READ_AHEAD_AREA]; + uint32_t page_nos[RECV_READ_AHEAD_AREA]; compile_time_assert(ut_is_2pow(RECV_READ_AHEAD_AREA)); page_id.set_page_no(ut_2pow_round(page_id.page_no(), RECV_READ_AHEAD_AREA)); const ulint up_limit = page_id.page_no() + RECV_READ_AHEAD_AREA; - ulint* p = page_nos; + uint32_t* p = page_nos; for (recv_sys_t::map::iterator i= recv_sys.pages.lower_bound(page_id); i != recv_sys.pages.end() diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index e0817934e67..7e24ff7ab5e 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -4501,9 +4501,9 @@ corrupted: ? ULINT_UNDEFINED : mach_read_from_4(FIL_PAGE_SPACE_ID + page); ulint flags = fsp_header_get_flags(page); - const ulint size = fsp_header_get_field(page, FSP_SIZE); - const ulint free_limit = fsp_header_get_field(page, FSP_FREE_LIMIT); - const ulint free_len = flst_get_len(FSP_HEADER_OFFSET + FSP_FREE + const uint32_t size = fsp_header_get_field(page, FSP_SIZE); + const uint32_t free_limit = fsp_header_get_field(page, FSP_FREE_LIMIT); + const uint32_t free_len = flst_get_len(FSP_HEADER_OFFSET + FSP_FREE + page); if (!fil_space_t::is_valid_flags(flags, space->id)) { ulint cflags = fsp_flags_convert_from_101(flags); @@ -4565,7 +4565,7 @@ invalid: space->flags = (space->flags & FSP_FLAGS_MEM_MASK) | flags; space->punch_hole = space->is_compressed(); - this->size = ulint(size_bytes / psize); + this->size = uint32_t(size_bytes / psize); space->committed_size = space->size += this->size; } else if (space->id != TRX_SYS_SPACE || space->size_in_header) { /* If this is not the first-time open, do nothing. diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 539c2e83f04..03706d9ae99 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -528,7 +528,7 @@ protected: /** Check if the page is marked as free in the extent descriptor. @param page_no page number to check in the extent descriptor. @return true if the page is marked as free */ - bool is_free(ulint page_no) const UNIV_NOTHROW + bool is_free(uint32_t page_no) const UNIV_NOTHROW { ut_a(xdes_calc_descriptor_page(get_zip_size(), page_no) == m_xdes_page_no); @@ -3437,7 +3437,7 @@ fil_iterate( os_offset_t page_off = offset; ulint n_pages_read = n_bytes / size; /* This block is not attached to buf_pool */ - block->page.id_.set_page_no(ulint(page_off / size)); + block->page.id_.set_page_no(uint32_t(page_off / size)); for (ulint i = 0; i < n_pages_read; ++block->page.id_, @@ -3859,7 +3859,6 @@ row_import_for_mysql( trx_t* trx; ib_uint64_t autoinc = 0; char* filepath = NULL; - ulint space_flags MY_ATTRIBUTE((unused)); /* The caller assured that this is not read_only_mode and that no temorary tablespace is being imported. */ @@ -3978,9 +3977,6 @@ row_import_for_mysql( err = cfg.set_root_by_heuristic(); } } - - space_flags = fetchIndexRootPages.get_space_flags(); - } else { rw_lock_s_unlock(&dict_sys.latch); } diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index a57a53aaaea..558bf6d5a07 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1999,18 +1999,14 @@ end_of_index: goto write_buffers; } } else { - ulint next_page_no; - buf_block_t* block; - - next_page_no = btr_page_get_next( + uint32_t next_page_no = btr_page_get_next( page_cur_get_page(cur)); if (next_page_no == FIL_NULL) { goto end_of_index; } - block = page_cur_get_block(cur); - block = btr_block_get( + buf_block_t* block = btr_block_get( *clust_index, next_page_no, RW_S_LATCH, false, &mtr); diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 9af0738faad..401a655517f 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -1109,7 +1109,7 @@ re_scan: /* MDEV-14059 FIXME: why re-latch the block? pcur is already positioned on it! */ - ulint page_no = page_get_page_no( + uint32_t page_no = page_get_page_no( btr_pcur_get_page(pcur)); cur_block = buf_page_get_gen( diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index dba660ee13f..5f800d390bf 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -562,7 +562,7 @@ err_exit: if (create) { - space->size= file->size= ulint(size >> srv_page_size_shift); + space->size= file->size= uint32_t(size >> srv_page_size_shift); space->size_in_header= SRV_UNDO_TABLESPACE_SIZE_IN_PAGES; space->committed_size= SRV_UNDO_TABLESPACE_SIZE_IN_PAGES; } @@ -1423,7 +1423,8 @@ file_checked: ut_ad(fil_system.sys_space->id == 0); compile_time_assert(TRX_SYS_SPACE == 0); compile_time_assert(IBUF_SPACE_ID == 0); - fsp_header_init(fil_system.sys_space, sum_of_new_sizes, &mtr); + fsp_header_init(fil_system.sys_space, + uint32_t(sum_of_new_sizes), &mtr); ulint ibuf_root = btr_create( DICT_CLUSTERED | DICT_IBUF, fil_system.sys_space, @@ -1545,7 +1546,8 @@ file_checked: mtr.write<4>(*block, FSP_HEADER_OFFSET + FSP_SIZE + block->frame, size); - fil_system.sys_space->size_in_header = size; + fil_system.sys_space->size_in_header + = uint32_t(size); mtr.commit(); /* Immediately write the log record about increased tablespace size to disk, so that it diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc index fb58687beab..2aee1636084 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -391,7 +391,7 @@ trx_rseg_mem_free(trx_rseg_t* rseg) @param[in] page_no page number of the segment header */ static trx_rseg_t* -trx_rseg_mem_create(ulint id, fil_space_t* space, ulint page_no) +trx_rseg_mem_create(ulint id, fil_space_t* space, uint32_t page_no) { trx_rseg_t* rseg = static_cast<trx_rseg_t*>( ut_zalloc_nokey(sizeof *rseg)); @@ -418,12 +418,12 @@ trx_rseg_mem_create(ulint id, fil_space_t* space, ulint page_no) @param[in,out] max_trx_id maximum observed transaction identifier @param[in] rseg_header rollback segment header @return the combined size of undo log segments in pages */ -static ulint trx_undo_lists_init(trx_rseg_t *rseg, trx_id_t &max_trx_id, - const buf_block_t *rseg_header) +static uint32_t trx_undo_lists_init(trx_rseg_t *rseg, trx_id_t &max_trx_id, + const buf_block_t *rseg_header) { ut_ad(srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN); - ulint size= 0; + uint32_t size= 0; for (ulint i= 0; i < TRX_RSEG_N_SLOTS; i++) { diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index ae3224a29a6..e6ec441bdeb 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -237,8 +237,8 @@ trx_undo_get_next_rec_from_next_page(buf_block_t *&block, uint32_t page_no, mach_read_from_2(block->frame + offset + TRX_UNDO_NEXT_LOG)) return NULL; - ulint next= flst_get_next_addr(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE + - block->frame).page; + uint32_t next= flst_get_next_addr(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE + + block->frame).page; if (next == FIL_NULL) return NULL; |