diff options
author | Monty <monty@mariadb.org> | 2017-03-06 16:25:01 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-03-16 14:21:33 +0200 |
commit | 2d0c579a86fb9f976ab447e5799084e39a615329 (patch) | |
tree | 3e624fc1bd4f78be0d65c79ad093260058c69251 /sql/slave.cc | |
parent | e7f55fde8817508b77bef0ec2352a02e1f0ea2c4 (diff) | |
download | mariadb-git-2d0c579a86fb9f976ab447e5799084e39a615329.tar.gz |
Wait for slave threads to start during startup
- Before this patch during startup all slave threads was started without
any check that they had started properly.
- If one did a START SLAVE, STOP SLAVE or CHANGE MASTER as first command to the server
there was a chance that server could access structures that where not
properly initialized which could lead to crashes in
Log_event::read_log_event
- Fixed by waiting for slave threads to start up properly also during
server startup, like we do with START SLAVE.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 36d28382c56..70b1c5b025e 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -421,12 +421,21 @@ int init_slave() if (active_mi->host[0] && !opt_skip_slave_start) { - if (start_slave_threads(1 /* need mutex */, - 0 /* no wait for start*/, - active_mi, - master_info_file, - relay_log_info_file, - SLAVE_IO | SLAVE_SQL)) + int error; + THD *thd= new THD; + thd->thread_stack= (char*) &thd; + thd->store_globals(); + + error= start_slave_threads(1 /* need mutex */, + 1 /* wait for start*/, + active_mi, + master_info_file, + relay_log_info_file, + SLAVE_IO | SLAVE_SQL); + + thd->reset_globals(); + delete thd; + if (error) { sql_print_error("Failed to create slave threads"); goto err; |