Skip to content

Commit a1315a6

Browse files
committed
MDEV-11202 InnoDB 10.1 -> 10.2 migration does not work
This is the final preparation for the merge of MDEV-11623 from MariaDB Server 10.1 (correcting the assignment of FSP_SPACE_FLAGS in MariaDB Server 10.1). We must avoid reading FSP_SPACE_FLAGS directly from page 0, because the flags that affect the uncompressed page size cannot be trusted if we are upgrading from MariaDB 10.1. We will pass fil_space_t* instead of a numeric tablespace ID in many low-level functions, so that fil_space_t::flags will be available. This will also reduce the amount o tablespace ID lookups and the pressure on fil_system->mutex. fil_space_is_being_truncated(), fil_space_is_redo_skipped(), PageCallback::set_page_size(), fsp_header_get_page_size(): Remove. fil_node_open_file(), fil_space_get_crypt_data(): Use space->flags. fsp_free_extent(), fseg_get_first_extent(), fsp_get_space_header(), xdes_get_descriptor_with_space_hdr(), xdes_get_descriptor(), xdes_lst_get_descriptor(), fsp_space_modify_check(), fsp_init_file_page(), fsp_alloc_free_extent(), fsp_page_create(), fsp_alloc_free_page(), fsp_free_page(), fsp_alloc_seg_inode_page(), fsp_alloc_seg_inode(), fsp_free_seg_inode(), fseg_fill_free_list(), fseg_mark_page_used(), fseg_free_page_low(), fseg_free_extent(): Take fil_space_t* as a parameter, instead of taking a numeric ID.
1 parent 8780b89 commit a1315a6

File tree

6 files changed

+284
-429
lines changed

6 files changed

+284
-429
lines changed

storage/innobase/fil/fil0fil.cc

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ fil_node_open_file(
659659

660660
os_file_close(node->handle);
661661

662-
const page_size_t page_size(flags);
662+
const page_size_t page_size(space->flags);
663663

664664
min_size = FIL_IBD_FILE_INITIAL_SIZE * page_size.physical();
665665

@@ -1903,20 +1903,6 @@ fil_space_get_flags(
19031903
return(flags);
19041904
}
19051905

1906-
/** Check if table is mark for truncate.
1907-
@param[in] id space id
1908-
@return true if tablespace is marked for truncate. */
1909-
bool
1910-
fil_space_is_being_truncated(
1911-
ulint id)
1912-
{
1913-
bool mark_for_truncate;
1914-
mutex_enter(&fil_system->mutex);
1915-
mark_for_truncate = fil_space_get_by_id(id)->is_being_truncated;
1916-
mutex_exit(&fil_system->mutex);
1917-
return(mark_for_truncate);
1918-
}
1919-
19201906
/** Open each fil_node_t of a named fil_space_t if not already open.
19211907
@param[in] name Tablespace name
19221908
@return true if all nodes are open */
@@ -3312,30 +3298,6 @@ fil_space_dec_redo_skipped_count(
33123298

33133299
mutex_exit(&fil_system->mutex);
33143300
}
3315-
3316-
/**
3317-
Check whether a single-table tablespace is redo skipped.
3318-
@param[in] id space id
3319-
@return true if redo skipped */
3320-
bool
3321-
fil_space_is_redo_skipped(
3322-
ulint id)
3323-
{
3324-
fil_space_t* space;
3325-
bool is_redo_skipped;
3326-
3327-
mutex_enter(&fil_system->mutex);
3328-
3329-
space = fil_space_get_by_id(id);
3330-
3331-
ut_a(space != NULL);
3332-
3333-
is_redo_skipped = space->redo_skipped_count > 0;
3334-
3335-
mutex_exit(&fil_system->mutex);
3336-
3337-
return(is_redo_skipped);
3338-
}
33393301
#endif /* UNIV_DEBUG */
33403302

33413303
/*******************************************************************//**
@@ -6131,15 +6093,6 @@ fil_tablespace_iterate(
61316093
return(err);
61326094
}
61336095

6134-
/** Set the tablespace table size.
6135-
@param[in] page a page belonging to the tablespace */
6136-
void
6137-
PageCallback::set_page_size(
6138-
const buf_frame_t* page) UNIV_NOTHROW
6139-
{
6140-
m_page_size.copy_from(fsp_header_get_page_size(page));
6141-
}
6142-
61436096
/********************************************************************//**
61446097
Delete the tablespace file and any related files like .cfg.
61456098
This should not be called for temporary tables.
@@ -6656,10 +6609,9 @@ fil_space_get_crypt_data(
66566609
byte *page = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
66576610
fil_read(page_id_t(space_id, 0), univ_page_size, 0, univ_page_size.physical(),
66586611
page);
6659-
ulint flags = fsp_header_get_flags(page);
66606612
ulint offset = FSP_HEADER_OFFSET
66616613
+ fsp_header_get_encryption_offset(
6662-
page_size_t(flags));
6614+
page_size_t(space->flags));
66636615
space->crypt_data = fil_space_read_crypt_data(space_id, page, offset);
66646616
ut_free(buf);
66656617

storage/innobase/fsp/fsp0file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ Datafile::read_first_page(bool read_only_mode)
353353
m_crypt_info = fil_space_read_crypt_data(
354354
m_space_id, m_first_page,
355355
FSP_HEADER_OFFSET + fsp_header_get_encryption_offset(
356-
fsp_header_get_page_size(m_first_page)));
356+
page_size_t(m_flags)));
357357

358358
return(err);
359359
}

0 commit comments

Comments
 (0)