summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorEugene Kosov <eugene.kosov@mariadb.com>2020-06-27 12:15:17 +0300
committerEugene Kosov <eugene.kosov@mariadb.com>2020-06-27 12:21:37 +0300
commit52c4abbff2ec4b97d6c69f238457bf759591ce15 (patch)
tree6ca489aa991dbb3a1a6e5b8e930b70e4e3605987 /storage
parent3c238ac51c21dd0b7ba410012cf317298873c0c2 (diff)
downloadmariadb-git-52c4abbff2ec4b97d6c69f238457bf759591ce15.tar.gz
MDEV-20213 binlog_encryption.binlog_incident failed in buildbot, server crashed in Check::validate
follow up fil_system.sys_space is a shared variable between the thread which assigns a value to it, and the thread which does Check::validate() SysTablespace::open_or_create(): protect a shared variable with a mutex to avoid any data race surprises.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/fsp/fsp0sysspace.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc
index dd4eb294dc4..6c185cbcf49 100644
--- a/storage/innobase/fsp/fsp0sysspace.cc
+++ b/storage/innobase/fsp/fsp0sysspace.cc
@@ -913,9 +913,13 @@ SysTablespace::open_or_create(
} else {
ut_ad(!fil_system.sys_space);
ut_ad(space_id() == TRX_SYS_SPACE);
- space = fil_system.sys_space = fil_space_create(
+ space = fil_space_create(
name(), TRX_SYS_SPACE, flags(),
FIL_TYPE_TABLESPACE, NULL);
+
+ mutex_enter(&fil_system.mutex);
+ fil_system.sys_space = space;
+ mutex_exit(&fil_system.mutex);
if (!space) {
return DB_ERROR;
}