From 53623d932a89dd4760fd28db42956b341ac451ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 22 Jul 2015 08:42:52 +0300 Subject: [PATCH] MDEV-8522: InnoDB: Assertion failure in file fil0fil.cc line 475 Analysis: In fil_crypt_space_needs_rotation we first make sure that tablespace is found and then separately that it is normal tablespace. Thus, tablespace could be dropped between these two functions calls. Fix: If space is not found from fil_system return tablespace type ULINT_UNDEFINED and naturally do not continue rotating space. --- storage/innobase/fil/fil0fil.cc | 11 +++++++---- storage/xtradb/fil/fil0fil.cc | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 9d1662802ba..7d8ce96ea3c 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -457,7 +457,7 @@ fil_space_get_latch( /*******************************************************************//** Returns the type of a file space. -@return FIL_TABLESPACE or FIL_LOG */ +@return ULINT_UNDEFINED, or FIL_TABLESPACE or FIL_LOG */ UNIV_INTERN ulint fil_space_get_type( @@ -465,6 +465,7 @@ fil_space_get_type( ulint id) /*!< in: space id */ { fil_space_t* space; + ulint type = ULINT_UNDEFINED; ut_ad(fil_system); @@ -472,11 +473,13 @@ fil_space_get_type( space = fil_space_get_by_id(id); - ut_a(space); - mutex_exit(&fil_system->mutex); - return(space->purpose); + if (space) { + type = space->purpose; + } + + return(type); } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index bb59c00f783..6d66fa64761 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -460,7 +460,7 @@ fil_space_get_latch( /*******************************************************************//** Returns the type of a file space. -@return FIL_TABLESPACE or FIL_LOG */ +@return ULINT_UNDEFINED, or FIL_TABLESPACE or FIL_LOG */ UNIV_INTERN ulint fil_space_get_type( @@ -468,6 +468,7 @@ fil_space_get_type( ulint id) /*!< in: space id */ { fil_space_t* space; + ulint type = ULINT_UNDEFINED; ut_ad(fil_system); @@ -475,11 +476,13 @@ fil_space_get_type( space = fil_space_get_by_id(id); - ut_a(space); - mutex_exit(&fil_system->mutex); - return(space->purpose); + if (space) { + type = space->purpose; + } + + return(type); } #endif /* !UNIV_HOTBACKUP */