diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-07-27 10:44:01 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-07-27 10:44:01 +0300 |
commit | afe00bb7cce7de279e48a83ededc71b3f8cfafcf (patch) | |
tree | 8a6fd605e0da16d629fe0a7a2521d531077a7e13 /storage | |
parent | e11cae71feb853dc6f2917a2b7ad2f41b294a9dc (diff) | |
download | mariadb-git-afe00bb7cce7de279e48a83ededc71b3f8cfafcf.tar.gz |
MDEV-25998 fixup: Avoid a hang
btr_scrub_start_space(): Avoid an unnecessary tablespace lookup
and related acquisition of fil_system->mutex. In MariaDB Server 10.3
we would get deadlocks between that mutex and a crypt_data mutex.
The fix was developed by Thirunarayanan Balathandayuthapani.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/btr/btr0scrub.cc | 16 | ||||
-rw-r--r-- | storage/innobase/fil/fil0crypt.cc | 2 | ||||
-rw-r--r-- | storage/innobase/include/btr0scrub.h | 7 |
3 files changed, 6 insertions, 19 deletions
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc index 60d9c90c310..685e98909db 100644 --- a/storage/innobase/btr/btr0scrub.cc +++ b/storage/innobase/btr/btr0scrub.cc @@ -1,5 +1,5 @@ // Copyright (c) 2014, Google Inc. -// Copyright (c) 2017, MariaDB Corporation. +// Copyright (c) 2017, 2021, MariaDB Corporation. /**************************************************//** @file btr/btr0scrub.cc @@ -835,20 +835,12 @@ btr_scrub_page( /**************************************************************//** Start iterating a space */ -UNIV_INTERN -bool -btr_scrub_start_space( -/*===================*/ - ulint space, /*!< in: space */ - btr_scrub_t* scrub_data) /*!< in/out: scrub data */ +bool btr_scrub_start_space(const fil_space_t &space, btr_scrub_t *scrub_data) { - bool found; - scrub_data->space = space; + scrub_data->space = space.id; scrub_data->current_table = NULL; scrub_data->current_index = NULL; - const page_size_t page_size = fil_space_get_page_size(space, &found); - - scrub_data->compressed = page_size.is_compressed(); + scrub_data->compressed = FSP_FLAGS_GET_ZIP_SSIZE(space.flags) != 0; scrub_data->scrubbing = check_scrub_setting(scrub_data); return scrub_data->scrubbing; } diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 310693dd02f..ff6294e85b7 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1200,7 +1200,7 @@ fil_crypt_space_needs_rotation( key_state->rotate_key_age); crypt_data->rotate_state.scrubbing.is_active = - btr_scrub_start_space(space->id, &state->scrub_data); + btr_scrub_start_space(*space, &state->scrub_data); time_t diff = time(0) - crypt_data->rotate_state.scrubbing. last_scrub_completed; diff --git a/storage/innobase/include/btr0scrub.h b/storage/innobase/include/btr0scrub.h index feaf61784d0..0f17467fb70 100644 --- a/storage/innobase/include/btr0scrub.h +++ b/storage/innobase/include/btr0scrub.h @@ -141,12 +141,7 @@ btr_scrub_skip_page( /**************************************************************** Start iterating a space * @return true if scrubbing is turned on */ -UNIV_INTERN -bool -btr_scrub_start_space( -/*===================*/ - ulint space, /*!< in: space */ - btr_scrub_t* scrub_data); /*!< in/out: scrub data */ +bool btr_scrub_start_space(const fil_space_t &space, btr_scrub_t *scrub_data); /** Complete iterating a space. @param[in,out] scrub_data scrub data */ |