1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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).
This commit is contained in:
Marko Mäkelä
2020-07-23 09:59:16 +03:00
parent d2982331a6
commit 52ccedd6dd
8 changed files with 26 additions and 18 deletions

View File

@@ -26,6 +26,7 @@ a
1 1
UPDATE t SET a=3 WHERE a=1; UPDATE t SET a=3 WHERE a=1;
ERROR HY000: Table 't' is read only ERROR HY000: Table 't' is read only
SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output;
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED. # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
# In earlier versions, this would return the last committed version # In earlier versions, this would return the last committed version
# (empty table)! # (empty table)!

View File

@@ -53,6 +53,7 @@ SELECT * FROM t;
UPDATE t SET a=3 WHERE a=1; UPDATE t SET a=3 WHERE a=1;
--let $restart_parameters= --innodb-read-only --let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output;
--echo # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED. --echo # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
--echo # In earlier versions, this would return the last committed version --echo # In earlier versions, this would return the last committed version
--echo # (empty table)! --echo # (empty table)!

View File

@@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
@@ -981,7 +981,7 @@ buf_LRU_check_size_of_non_data_objects(
+ UT_LIST_GET_LEN(buf_pool->LRU)) + UT_LIST_GET_LEN(buf_pool->LRU))
< buf_pool->curr_size / 3) { < 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 /* Over 67 % of the buffer pool is occupied by lock
heaps or the adaptive hash index. This may be a memory heaps or the adaptive hash index. This may be a memory

View File

@@ -18480,11 +18480,14 @@ static
void void
innodb_status_output_update(THD*,st_mysql_sys_var*,void*var,const void*save) 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); *static_cast<my_bool*>(var)= *static_cast<const my_bool*>(save);
mysql_mutex_unlock(&LOCK_global_system_variables); if (srv_monitor_event)
/* Wakeup server monitor thread. */ {
os_event_set(srv_monitor_event); mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&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. /** Update the system variable innodb_encryption_threads.

View File

@@ -2,7 +2,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. 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 Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1077,7 +1077,7 @@ sync_array_print_long_waits(
sync_array_exit(arr); sync_array_exit(arr);
} }
if (noticed) { if (noticed && srv_monitor_event) {
ibool old_val; ibool old_val;
fprintf(stderr, fprintf(stderr,

View File

@@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 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)) + UT_LIST_GET_LEN(buf_pool->LRU))
< buf_pool->curr_size / 3) { < 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 /* Over 67 % of the buffer pool is occupied by lock
heaps or the adaptive hash index. This may be a memory heaps or the adaptive hash index. This may be a memory

View File

@@ -19457,11 +19457,14 @@ static
void void
innodb_status_output_update(THD*,st_mysql_sys_var*,void*var,const void*save) 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); *static_cast<my_bool*>(var)= *static_cast<const my_bool*>(save);
mysql_mutex_unlock(&LOCK_global_system_variables); if (srv_monitor_event)
/* Wakeup server monitor thread. */ {
os_event_set(srv_monitor_event); mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&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. /** Update the system variable innodb_encryption_threads.

View File

@@ -2,7 +2,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. 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 Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1164,7 +1164,7 @@ sync_array_print_long_waits(
sync_array_exit(arr); sync_array_exit(arr);
} }
if (noticed) { if (noticed && srv_monitor_event) {
ibool old_val; ibool old_val;
fprintf(stderr, fprintf(stderr,