summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <mats@mysql.com>2004-11-25 13:35:53 +0100
committerunknown <mats@mysql.com>2004-11-25 13:35:53 +0100
commit32f93da0937a842ad8070705cf746ac1b5f89857 (patch)
tree1f09642d681733004300499bee2f77ba923588d7 /sql
parent207676814b6f464441498e95ad809498a2948130 (diff)
parentc4dbf1e969253f3b65106036af0f47a600a77ad5 (diff)
downloadmariadb-git-32f93da0937a842ad8070705cf746ac1b5f89857.tar.gz
Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/space/bkroot/mysql-4.1
Diffstat (limited to 'sql')
-rw-r--r--sql/repl_failsafe.cc4
-rw-r--r--sql/slave.cc14
-rw-r--r--sql/slave.h3
-rw-r--r--sql/sql_repl.cc6
4 files changed, 19 insertions, 8 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 720e82f414e..356ec80608c 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -921,8 +921,8 @@ int load_master_data(THD* thd)
*/
int error;
- if (init_master_info(active_mi, master_info_file, relay_log_info_file,
- 0))
+ if (init_master_info(active_mi, master_info_file, relay_log_info_file,
+ 0, (SLAVE_IO | SLAVE_SQL)))
send_error(thd, ER_MASTER_INFO);
strmake(active_mi->master_log_name, row[0],
sizeof(active_mi->master_log_name));
diff --git a/sql/slave.cc b/sql/slave.cc
index 6bc977e8d41..6d5c997bade 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -161,7 +161,7 @@ int init_slave()
}
if (init_master_info(active_mi,master_info_file,relay_log_info_file,
- !master_host))
+ !master_host, (SLAVE_IO | SLAVE_SQL)))
{
sql_print_error("Failed to initialize the master info structure");
goto err;
@@ -1799,7 +1799,8 @@ void clear_until_condition(RELAY_LOG_INFO* rli)
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
const char* slave_info_fname,
- bool abort_if_no_master_info_file)
+ bool abort_if_no_master_info_file,
+ int thread_mask)
{
int fd,error;
char fname[FN_REFLEN+128];
@@ -1813,8 +1814,15 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
last time. If this case pos_in_file would be set and we would
get a crash when trying to read the signature for the binary
relay log.
+
+ We only rewind the read position if we are starting the SQL
+ thread. The handle_slave_sql thread assumes that the read
+ position is at the beginning of the file, and will read the
+ "signature" and then fast-forward to the last position read.
*/
- my_b_seek(mi->rli.cur_log, (my_off_t) 0);
+ if (thread_mask & SLAVE_SQL) {
+ my_b_seek(mi->rli.cur_log, (my_off_t) 0);
+ }
DBUG_RETURN(0);
}
diff --git a/sql/slave.h b/sql/slave.h
index c6cb81699a2..a4d123329c6 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -522,7 +522,8 @@ void clear_until_condition(RELAY_LOG_INFO* rli);
void clear_slave_error_timestamp(RELAY_LOG_INFO* rli);
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
const char* slave_info_fname,
- bool abort_if_no_master_info_file);
+ bool abort_if_no_master_info_file,
+ int thread_mask);
void end_master_info(MASTER_INFO* mi);
int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname);
void end_relay_log_info(RELAY_LOG_INFO* rli);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index a84b63c270b..bbcea537ff1 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -683,7 +683,8 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
thread_mask&= thd->lex->slave_thd_opt;
if (thread_mask) //some threads are stopped, start them
{
- if (init_master_info(mi,master_info_file,relay_log_info_file, 0))
+ if (init_master_info(mi,master_info_file,relay_log_info_file, 0,
+ thread_mask))
slave_errno=ER_MASTER_INFO;
else if (server_id_supplied && *mi->host)
{
@@ -978,7 +979,8 @@ int change_master(THD* thd, MASTER_INFO* mi)
thd->proc_info = "Changing master";
LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
// TODO: see if needs re-write
- if (init_master_info(mi, master_info_file, relay_log_info_file, 0))
+ if (init_master_info(mi, master_info_file, relay_log_info_file, 0,
+ thread_mask))
{
send_error(thd, ER_MASTER_INFO);
unlock_slave_threads(mi);