diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-03-27 11:49:57 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-03-29 20:47:42 +0300 |
commit | 330ecb906d0aa416a67a93332ef3ef446cfd0f32 (patch) | |
tree | 72664af728535021beee6afd5bd38ef5dabeebf2 /storage/innobase | |
parent | 05863142ad0db0cb49f675b2a527a953d187a565 (diff) | |
download | mariadb-git-330ecb906d0aa416a67a93332ef3ef446cfd0f32.tar.gz |
MDEV-12266: fsp_flags_try_adjust(): Remove lookup
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 25 | ||||
-rw-r--r-- | storage/innobase/include/fil0fil.h | 6 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 4 |
3 files changed, 15 insertions, 20 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 3d38102a6a6..fbcb75f696f 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -3514,7 +3514,8 @@ fil_ibd_open( mutex_exit(&fil_system.mutex); 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; @@ -3816,7 +3817,8 @@ skip_validate: df_remote.close(); df_dict.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( /** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations. (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 */ -UNIV_INTERN -void -fsp_flags_try_adjust(ulint space_id, ulint flags) +void fsp_flags_try_adjust(fil_space_t* space, ulint flags) { ut_ad(!srv_read_only_mode); - ut_ad(fsp_flags_is_valid(flags, space_id)); - mutex_enter(&fil_system.mutex); - fil_space_t* space = fil_space_get_space(space_id); - if (!space || !space->size) { - mutex_exit(&fil_system.mutex); + ut_ad(fsp_flags_is_valid(flags, space->id)); + if (!space->size) { return; } /* This code is executed during server startup while no connections are allowed. We do not need to protect against DROP TABLE by fil_space_acquire(). */ - mutex_exit(&fil_system.mutex); mtr_t mtr; mtr.start(); 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)) { ulint f = fsp_header_get_flags(b->frame); /* Suppress the message if only the DATA_DIR flag to differs. */ @@ -4330,7 +4326,8 @@ func_exit: mutex_exit(&fil_system.mutex); 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); diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index ae4a06d343d..c111a0ef647 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1037,11 +1037,9 @@ fil_ibd_create( /** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations. (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 */ -UNIV_INTERN -void -fsp_flags_try_adjust(ulint space_id, ulint flags); +void fsp_flags_try_adjust(fil_space_t* space, ulint flags); /********************************************************************//** Tries to open a single-table tablespace and optionally checks the space id is diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 0aed6290f37..135ae1953a6 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -2240,8 +2240,8 @@ files_checked: if (!srv_read_only_mode) { const ulint flags = FSP_FLAGS_PAGE_SSIZE(); for (ulint id = 0; id <= srv_undo_tablespaces; id++) { - if (fil_space_get(id)) { - fsp_flags_try_adjust(id, flags); + if (fil_space_t* space = fil_space_get(id)) { + fsp_flags_try_adjust(space, flags); } } |