Commit 330ecb90 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12266: fsp_flags_try_adjust(): Remove lookup

parent 05863142
...@@ -3514,7 +3514,8 @@ fil_ibd_open( ...@@ -3514,7 +3514,8 @@ fil_ibd_open(
mutex_exit(&fil_system.mutex); mutex_exit(&fil_system.mutex);
if (err == DB_SUCCESS && validate && !srv_read_only_mode) { if (err == DB_SUCCESS && validate && !srv_read_only_mode) {
fsp_flags_try_adjust(id, flags & ~FSP_FLAGS_MEM_MASK); fsp_flags_try_adjust(space,
flags & ~FSP_FLAGS_MEM_MASK);
} }
return err; return err;
...@@ -3816,7 +3817,8 @@ fil_ibd_open( ...@@ -3816,7 +3817,8 @@ fil_ibd_open(
df_remote.close(); df_remote.close();
df_dict.close(); df_dict.close();
df_default.close(); df_default.close();
fsp_flags_try_adjust(id, flags & ~FSP_FLAGS_MEM_MASK); fsp_flags_try_adjust(space,
flags & ~FSP_FLAGS_MEM_MASK);
} }
} }
...@@ -4218,28 +4220,22 @@ fil_report_missing_tablespace( ...@@ -4218,28 +4220,22 @@ fil_report_missing_tablespace(
/** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations. /** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations.
(Typically when upgrading from MariaDB 10.1.0..10.1.20.) (Typically when upgrading from MariaDB 10.1.0..10.1.20.)
@param[in] space_id tablespace ID @param[in,out] space tablespace
@param[in] flags desired tablespace flags */ @param[in] flags desired tablespace flags */
UNIV_INTERN void fsp_flags_try_adjust(fil_space_t* space, ulint flags)
void
fsp_flags_try_adjust(ulint space_id, ulint flags)
{ {
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
ut_ad(fsp_flags_is_valid(flags, space_id)); ut_ad(fsp_flags_is_valid(flags, space->id));
mutex_enter(&fil_system.mutex); if (!space->size) {
fil_space_t* space = fil_space_get_space(space_id);
if (!space || !space->size) {
mutex_exit(&fil_system.mutex);
return; return;
} }
/* This code is executed during server startup while no /* This code is executed during server startup while no
connections are allowed. We do not need to protect against connections are allowed. We do not need to protect against
DROP TABLE by fil_space_acquire(). */ DROP TABLE by fil_space_acquire(). */
mutex_exit(&fil_system.mutex);
mtr_t mtr; mtr_t mtr;
mtr.start(); mtr.start();
if (buf_block_t* b = buf_page_get( if (buf_block_t* b = buf_page_get(
page_id_t(space_id, 0), page_size_t(flags), page_id_t(space->id, 0), page_size_t(flags),
RW_X_LATCH, &mtr)) { RW_X_LATCH, &mtr)) {
ulint f = fsp_header_get_flags(b->frame); ulint f = fsp_header_get_flags(b->frame);
/* Suppress the message if only the DATA_DIR flag to differs. */ /* Suppress the message if only the DATA_DIR flag to differs. */
...@@ -4330,7 +4326,8 @@ fil_space_for_table_exists_in_mem( ...@@ -4330,7 +4326,8 @@ fil_space_for_table_exists_in_mem(
mutex_exit(&fil_system.mutex); mutex_exit(&fil_system.mutex);
if (valid && !srv_read_only_mode) { if (valid && !srv_read_only_mode) {
fsp_flags_try_adjust(id, expected_flags & ~FSP_FLAGS_MEM_MASK); fsp_flags_try_adjust(space,
expected_flags & ~FSP_FLAGS_MEM_MASK);
} }
return(valid); return(valid);
......
...@@ -1037,11 +1037,9 @@ fil_ibd_create( ...@@ -1037,11 +1037,9 @@ fil_ibd_create(
/** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations. /** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations.
(Typically when upgrading from MariaDB 10.1.0..10.1.20.) (Typically when upgrading from MariaDB 10.1.0..10.1.20.)
@param[in] space_id tablespace ID @param[in,out] space tablespace
@param[in] flags desired tablespace flags */ @param[in] flags desired tablespace flags */
UNIV_INTERN void fsp_flags_try_adjust(fil_space_t* space, ulint flags);
void
fsp_flags_try_adjust(ulint space_id, ulint flags);
/********************************************************************//** /********************************************************************//**
Tries to open a single-table tablespace and optionally checks the space id is Tries to open a single-table tablespace and optionally checks the space id is
......
...@@ -2240,8 +2240,8 @@ innobase_start_or_create_for_mysql() ...@@ -2240,8 +2240,8 @@ innobase_start_or_create_for_mysql()
if (!srv_read_only_mode) { if (!srv_read_only_mode) {
const ulint flags = FSP_FLAGS_PAGE_SSIZE(); const ulint flags = FSP_FLAGS_PAGE_SSIZE();
for (ulint id = 0; id <= srv_undo_tablespaces; id++) { for (ulint id = 0; id <= srv_undo_tablespaces; id++) {
if (fil_space_get(id)) { if (fil_space_t* space = fil_space_get(id)) {
fsp_flags_try_adjust(id, flags); fsp_flags_try_adjust(space, flags);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment