summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-03-03 15:37:03 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-03-03 15:37:38 +0530
commitf080863501972af381877c6c2335b8dcf3e87830 (patch)
tree0a8e8db7bd2a25be42a42f565460fdea938affc7
parent676987c4a14069d415c56d0f259aaaa7ca742c23 (diff)
downloadmariadb-git-f080863501972af381877c6c2335b8dcf3e87830.tar.gz
MDEV-20648 InnoDB: Failing assertion: !(*node)->being_extended, innodb.log_data_file_size failed in buildbot, assertion `!space->is_stopping()'bb-10.2-MDEV-20648
InnoDB should check whether the tablespace is being deleted while extending the tablespace.
-rw-r--r--storage/innobase/fil/fil0fil.cc40
1 files changed, 26 insertions, 14 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index c71dbeff421..5adbd4df69e 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1038,15 +1038,14 @@ fil_space_extend_must_retry(
}
-/*******************************************************************//**
-Reserves the fil_system mutex and tries to make sure we can open at least one
+/** Reserves the fil_system mutex and tries to make sure we can open at least one
file while holding it. This should be called before calling
-fil_node_prepare_for_io(), because that function may need to open a file. */
+fil_node_prepare_for_io(), because that function may need to open a file.
+@param[in] space_id tablespace id
+@return whether the tablespace is usable for io */
static
-void
-fil_mutex_enter_and_prepare_for_io(
-/*===============================*/
- ulint space_id) /*!< in: space id */
+bool
+fil_mutex_enter_and_prepare_for_io(ulint space_id)
{
for (ulint count = 0;;) {
mutex_enter(&fil_system->mutex);
@@ -1059,7 +1058,7 @@ fil_mutex_enter_and_prepare_for_io(
fil_space_t* space = fil_space_get_by_id(space_id);
if (space == NULL) {
- break;
+ return false;
}
fil_node_t* node = UT_LIST_GET_LAST(space->chain);
@@ -1074,6 +1073,10 @@ fil_mutex_enter_and_prepare_for_io(
the insert buffer. The insert buffer is in
tablespace 0, and we cannot end up waiting in
this function. */
+ } else if (space->is_stopping() && !space->is_being_truncated) {
+ /* If the tablespace is being deleted then InnoDB
+ shouldn't prepare the tablespace for i/o */
+ return false;
} else if (!node || node->is_open()) {
/* If the file is already open, no need to do
anything; if the space does not exist, we handle the
@@ -1144,6 +1147,8 @@ fil_mutex_enter_and_prepare_for_io(
break;
}
+
+ return true;
}
/** Try to extend a tablespace if it is smaller than the specified size.
@@ -1160,7 +1165,10 @@ fil_space_extend(
bool success;
do {
- fil_mutex_enter_and_prepare_for_io(space->id);
+ if (!fil_mutex_enter_and_prepare_for_io(space->id)) {
+ success = false;
+ break;
+ }
} while (fil_space_extend_must_retry(
space, UT_LIST_GET_LAST(space->chain), size,
&success));
@@ -1537,7 +1545,9 @@ fil_space_t* fil_system_t::read_page0(ulint id)
/* It is possible that the tablespace is dropped while we are
not holding the mutex. */
- fil_mutex_enter_and_prepare_for_io(id);
+ if (!fil_mutex_enter_and_prepare_for_io(id)) {
+ return NULL;
+ }
fil_space_t* space = fil_space_get_by_id(id);
@@ -1610,14 +1620,16 @@ fil_space_get_first_path(
ut_ad(fil_system);
ut_a(id);
- fil_mutex_enter_and_prepare_for_io(id);
+ if (!fil_mutex_enter_and_prepare_for_io(id)) {
+fail_exit:
+ mutex_exit(&fil_system->mutex);
+ return(NULL);
+ }
space = fil_space_get_space(id);
if (space == NULL) {
- mutex_exit(&fil_system->mutex);
-
- return(NULL);
+ goto fail_exit;
}
ut_ad(mutex_own(&fil_system->mutex));