diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-09-16 23:20:57 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-09-16 23:20:57 -0400 |
commit | db2e21bf3ea32115e25bc6d9f67249042f16cadb (patch) | |
tree | 995698c9f4df3ae33865b788429d22f0f5ba6bc5 /sql/wsrep_mysqld.cc | |
parent | fd1b2e486a9a81ffb5416e7a0a0d85d15598c77c (diff) | |
download | mariadb-git-db2e21bf3ea32115e25bc6d9f67249042f16cadb.tar.gz |
MDEV-8208: Sporadic SEGFAULT on startup
Problem:
When mysqld starts as a galera node, it creates 2 system threads
(applier & rollbacker) using start_wsrep_THD(). These threads are
created before plugin initialization (plugin_init()) for SST methods
like rsync and xtrabackup.
The threads' initialization itself can proceed in parallel to mysqld's
main thread of execution. As a result, the thread initialization code
(start_wsrep_THD()) can end up accessing some un/partially initialized
structures (like maria_hton, in this particular case) resulting in
segfault.
Solution:
Fixed by calling THD::init_for_queries() (which accesses maria_hton)
only after the plugins have been initialized.
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r-- | sql/wsrep_mysqld.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index a154809d132..c570c7b831d 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -65,6 +65,13 @@ my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave // restart will be needed my_bool wsrep_slave_UK_checks = 0; // slave thread does UK checks my_bool wsrep_slave_FK_checks = 0; // slave thread does FK checks + +/* + Set during the creation of first wsrep applier and rollback threads. + Since these threads are critical, abort if the thread creation fails. +*/ +my_bool wsrep_creating_startup_threads = 0; + /* * End configuration options */ @@ -700,6 +707,7 @@ void wsrep_init_startup (bool first) if (!wsrep_start_replication()) unireg_abort(1); + wsrep_creating_startup_threads= 1; wsrep_create_rollbacker(); wsrep_create_appliers(1); |