diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-23 09:59:16 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-23 09:59:16 +0300 |
commit | 52ccedd6dd50e8e5cd8ca9b1be84bc5e87c20950 (patch) | |
tree | 1013d61224f823847e5ba6c733cc9aeab75e8801 /storage/xtradb | |
parent | d2982331a62e22ff10fd7768f450303bc90d1caf (diff) | |
download | mariadb-git-52ccedd6dd50e8e5cd8ca9b1be84bc5e87c20950.tar.gz |
MDEV-23268 SIGSEGV on srv_monitor_event if InnoDB is read-only
The srv_monitor_event and the srv_monitor_thread would not be
created when InnoDB is in read-only mode. Yet, some code would
unconditionally invoke os_event_set(srv_monitor_event).
Diffstat (limited to 'storage/xtradb')
-rw-r--r-- | storage/xtradb/buf/buf0lru.cc | 4 | ||||
-rw-r--r-- | storage/xtradb/handler/ha_innodb.cc | 13 | ||||
-rw-r--r-- | storage/xtradb/sync/sync0arr.cc | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/storage/xtradb/buf/buf0lru.cc b/storage/xtradb/buf/buf0lru.cc index 13bf5e79f2d..9a577bc3010 100644 --- a/storage/xtradb/buf/buf0lru.cc +++ b/storage/xtradb/buf/buf0lru.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1049,7 +1049,7 @@ buf_LRU_check_size_of_non_data_objects( + UT_LIST_GET_LEN(buf_pool->LRU)) < buf_pool->curr_size / 3) { - if (!buf_lru_switched_on_innodb_mon) { + if (!buf_lru_switched_on_innodb_mon && srv_monitor_event) { /* Over 67 % of the buffer pool is occupied by lock heaps or the adaptive hash index. This may be a memory diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 0a77ce56eaf..1cbe334ef09 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -19457,11 +19457,14 @@ static void innodb_status_output_update(THD*,st_mysql_sys_var*,void*var,const void*save) { - *static_cast<my_bool*>(var) = *static_cast<const my_bool*>(save); - mysql_mutex_unlock(&LOCK_global_system_variables); - /* Wakeup server monitor thread. */ - os_event_set(srv_monitor_event); - mysql_mutex_lock(&LOCK_global_system_variables); + *static_cast<my_bool*>(var)= *static_cast<const my_bool*>(save); + if (srv_monitor_event) + { + mysql_mutex_unlock(&LOCK_global_system_variables); + /* Wakeup server monitor thread. */ + os_event_set(srv_monitor_event); + mysql_mutex_lock(&LOCK_global_system_variables); + } } /** Update the system variable innodb_encryption_threads. diff --git a/storage/xtradb/sync/sync0arr.cc b/storage/xtradb/sync/sync0arr.cc index c085e8ebcf5..4de46089790 100644 --- a/storage/xtradb/sync/sync0arr.cc +++ b/storage/xtradb/sync/sync0arr.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -1164,7 +1164,7 @@ sync_array_print_long_waits( sync_array_exit(arr); } - if (noticed) { + if (noticed && srv_monitor_event) { ibool old_val; fprintf(stderr, |