mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-8501: encryption.create_or_replace fails in buildbot on P8 builders
Analysis: There is race between drop table and encryption threads that could cause encryption thread to enter mutex that has been already released. Fix: When destroying crypt_data first enter the mutex and set crypt data unavailable, then release the memory and clean up the data. This should make the race more unprobable. Additionally, added big_test for create_or_replace as it could fail testcase timeout if you have slow I/O (tested that testcase passes with --mem).
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
--source include/have_innodb.inc
|
--source include/have_innodb.inc
|
||||||
--source include/have_file_key_management_plugin.inc
|
--source include/have_file_key_management_plugin.inc
|
||||||
--source include/not_embedded.inc
|
--source include/not_embedded.inc
|
||||||
|
# This is needed for longer testcase timeout at least P7/P8
|
||||||
|
--source include/big_test.inc
|
||||||
|
|
||||||
#
|
#
|
||||||
# MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing or alike
|
# MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing or alike
|
||||||
|
@@ -364,6 +364,12 @@ fil_space_destroy_crypt_data(
|
|||||||
fil_space_crypt_t **crypt_data) /*!< out: crypt data */
|
fil_space_crypt_t **crypt_data) /*!< out: crypt data */
|
||||||
{
|
{
|
||||||
if (crypt_data != NULL && (*crypt_data) != NULL) {
|
if (crypt_data != NULL && (*crypt_data) != NULL) {
|
||||||
|
/* Make sure that this thread owns the crypt_data
|
||||||
|
and make it unawailable, this does not fully
|
||||||
|
avoid the race between drop table and crypt thread */
|
||||||
|
mutex_enter(&(*crypt_data)->mutex);
|
||||||
|
(*crypt_data)->inited = false;
|
||||||
|
mutex_exit(&(*crypt_data)->mutex);
|
||||||
mutex_free(&(*crypt_data)->mutex);
|
mutex_free(&(*crypt_data)->mutex);
|
||||||
memset(*crypt_data, 0, sizeof(fil_space_crypt_t));
|
memset(*crypt_data, 0, sizeof(fil_space_crypt_t));
|
||||||
free(*crypt_data);
|
free(*crypt_data);
|
||||||
|
@@ -364,6 +364,12 @@ fil_space_destroy_crypt_data(
|
|||||||
fil_space_crypt_t **crypt_data) /*!< out: crypt data */
|
fil_space_crypt_t **crypt_data) /*!< out: crypt data */
|
||||||
{
|
{
|
||||||
if (crypt_data != NULL && (*crypt_data) != NULL) {
|
if (crypt_data != NULL && (*crypt_data) != NULL) {
|
||||||
|
/* Make sure that this thread owns the crypt_data
|
||||||
|
and make it unawailable, this does not fully
|
||||||
|
avoid the race between drop table and crypt thread */
|
||||||
|
mutex_enter(&(*crypt_data)->mutex);
|
||||||
|
(*crypt_data)->inited = false;
|
||||||
|
mutex_exit(&(*crypt_data)->mutex);
|
||||||
mutex_free(& (*crypt_data)->mutex);
|
mutex_free(& (*crypt_data)->mutex);
|
||||||
memset(*crypt_data, 0, sizeof(fil_space_crypt_t));
|
memset(*crypt_data, 0, sizeof(fil_space_crypt_t));
|
||||||
free(*crypt_data);
|
free(*crypt_data);
|
||||||
|
Reference in New Issue
Block a user