summaryrefslogtreecommitdiff
path: root/storage/innobase/fil/fil0fil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/fil/fil0fil.cc')
-rw-r--r--storage/innobase/fil/fil0fil.cc87
1 files changed, 45 insertions, 42 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 1f13e2abfcc..f02f304a858 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -327,6 +327,7 @@ fil_space_get_by_id(
{
fil_space_t* space;
+ ut_ad(fil_system.is_initialised());
ut_ad(mutex_own(&fil_system.mutex));
HASH_SEARCH(hash, fil_system.spaces, id,
@@ -1358,6 +1359,47 @@ fil_assign_new_space_id(
return(success);
}
+/** Trigger a call to fil_node_t::read_page0()
+@param[in] id tablespace identifier
+@return tablespace
+@retval NULL if the tablespace does not exist or cannot be read */
+fil_space_t* fil_system_t::read_page0(ulint id)
+{
+ mutex_exit(&mutex);
+
+ ut_ad(id != 0);
+
+ /* It is possible that the tablespace is dropped while we are
+ not holding the mutex. */
+ fil_mutex_enter_and_prepare_for_io(id);
+
+ fil_space_t* space = fil_space_get_by_id(id);
+
+ if (space == NULL || UT_LIST_GET_LEN(space->chain) == 0) {
+ return(NULL);
+ }
+
+ /* The following code must change when InnoDB supports
+ multiple datafiles per tablespace. */
+ ut_a(1 == UT_LIST_GET_LEN(space->chain));
+
+ fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
+
+ /* It must be a single-table tablespace and we have not opened
+ the file yet; the following calls will open it and update the
+ size fields */
+
+ if (!fil_node_prepare_for_io(node, space)) {
+ /* The single-table tablespace can't be opened,
+ because the ibd file is missing. */
+ return(NULL);
+ }
+
+ fil_node_complete_io(node, IORequestRead);
+
+ return space;
+}
+
/*******************************************************************//**
Returns a pointer to the fil_space_t that is in the memory cache
associated with a space id. The caller must lock fil_system.mutex.
@@ -1368,12 +1410,7 @@ fil_space_get_space(
/*================*/
ulint id) /*!< in: space id */
{
- fil_space_t* space;
- fil_node_t* node;
-
- ut_ad(fil_system.is_initialised());
-
- space = fil_space_get_by_id(id);
+ fil_space_t* space = fil_space_get_by_id(id);
if (space == NULL || space->size != 0) {
return(space);
}
@@ -1384,41 +1421,7 @@ fil_space_get_space(
case FIL_TYPE_TEMPORARY:
case FIL_TYPE_TABLESPACE:
case FIL_TYPE_IMPORT:
- ut_a(id != 0);
-
- mutex_exit(&fil_system.mutex);
-
- /* It is possible that the space gets evicted at this point
- before the fil_mutex_enter_and_prepare_for_io() acquires
- the fil_system.mutex. Check for this after completing the
- call to fil_mutex_enter_and_prepare_for_io(). */
- fil_mutex_enter_and_prepare_for_io(id);
-
- /* We are still holding the fil_system.mutex. Check if
- the space is still in memory cache. */
- space = fil_space_get_by_id(id);
-
- if (space == NULL || UT_LIST_GET_LEN(space->chain) == 0) {
- return(NULL);
- }
-
- /* The following code must change when InnoDB supports
- multiple datafiles per tablespace. */
- ut_a(1 == UT_LIST_GET_LEN(space->chain));
-
- node = UT_LIST_GET_FIRST(space->chain);
-
- /* It must be a single-table tablespace and we have not opened
- the file yet; the following calls will open it and update the
- size fields */
-
- if (!fil_node_prepare_for_io(node, space)) {
- /* The single-table tablespace can't be opened,
- because the ibd file is missing. */
- return(NULL);
- }
-
- fil_node_complete_io(node, IORequestRead);
+ space = fil_system.read_page0(id);
}
return(space);
@@ -4587,7 +4590,7 @@ fil_validate(void)
ut_a(fil_system.n_open == n_open);
- UT_LIST_CHECK(fil_system.LRU);
+ ut_list_validate(fil_system.LRU);
for (fil_node = UT_LIST_GET_FIRST(fil_system.LRU);
fil_node != 0;