mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
Merge mysql.com:/home/timka/mysql/src/4.0-virgin
into mysql.com:/home/timka/mysql/src/4.0-master
This commit is contained in:
commit
f1e86036ee
7 changed files with 66 additions and 7 deletions
|
@ -72,6 +72,7 @@ kostja@oak.local
|
|||
lenz@kallisto.mysql.com
|
||||
lenz@mysql.com
|
||||
marko@hundin.mysql.fi
|
||||
mats@mysql.com
|
||||
matt@mysql.com
|
||||
miguel@hegel.(none)
|
||||
miguel@hegel.br
|
||||
|
|
12
mysql-test/r/rpl_start_stop_slave.result
Normal file
12
mysql-test/r/rpl_start_stop_slave.result
Normal file
|
@ -0,0 +1,12 @@
|
|||
slave stop;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
stop slave;
|
||||
create table t1(n int);
|
||||
start slave;
|
||||
stop slave io_thread;
|
||||
start slave io_thread;
|
||||
drop table t1;
|
34
mysql-test/t/rpl_start_stop_slave.test
Normal file
34
mysql-test/t/rpl_start_stop_slave.test
Normal file
|
@ -0,0 +1,34 @@
|
|||
source include/master-slave.inc;
|
||||
|
||||
#
|
||||
# Bug#6148 ()
|
||||
#
|
||||
connection slave;
|
||||
stop slave;
|
||||
|
||||
# Let the master do lots of insertions
|
||||
connection master;
|
||||
create table t1(n int);
|
||||
let $1=5000;
|
||||
disable_query_log;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values($1);
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
save_master_pos;
|
||||
|
||||
connection slave;
|
||||
start slave;
|
||||
sleep 1;
|
||||
stop slave io_thread;
|
||||
start slave io_thread;
|
||||
sync_with_master;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
|
||||
connection slave;
|
||||
sync_with_master;
|
|
@ -892,7 +892,8 @@ int load_master_data(THD* thd)
|
|||
setting active_mi, because init_master_info() sets active_mi with
|
||||
defaults.
|
||||
*/
|
||||
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->net, ER_MASTER_INFO);
|
||||
strmake(active_mi->master_log_name, row[0],
|
||||
sizeof(active_mi->master_log_name));
|
||||
|
|
14
sql/slave.cc
14
sql/slave.cc
|
@ -137,7 +137,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;
|
||||
|
@ -1616,7 +1616,8 @@ void clear_last_slave_error(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];
|
||||
|
@ -1630,8 +1631,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -411,7 +411,8 @@ void init_master_info_with_options(MASTER_INFO* mi);
|
|||
void clear_last_slave_error(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);
|
||||
|
|
|
@ -662,7 +662,8 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
|
|||
thread_mask &= thd->lex.slave_thd_opt;
|
||||
if (thread_mask)
|
||||
{
|
||||
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)
|
||||
slave_errno = start_slave_threads(0 /*no mutex */,
|
||||
|
@ -867,7 +868,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->net, ER_MASTER_INFO);
|
||||
unlock_slave_threads(mi);
|
||||
|
|
Loading…
Add table
Reference in a new issue