a code fix (don't specify default value of argument twice), updating a line of SHOW SLAVE STATUS
in tests after the last 4.1->5.0 merge, and: *** The same as ChangeSet@1.1822.1.1, 2004-05-14 23:08:03+02:00, guilhem@mysql.com of MySQL 4.0 *** Replication testsuite: making the master-slave synchronization less likely to fail, by adding sleep-and-retries (max 4 times) if MASTER_POS_WAIT() returns NULL in sync_with_master and sync_slave_with_master. The problem showed up only today, in MySQL 5.0 in rpl_server_id2.test, but may affect 4.x as well, so I fixed 4.x too. Note that I am also fixing 5.0, with the same exact patch, because I don't want to leave 5.0 broken until the next 4.0->4.1->5.0 merge. client/mysqltest.c: in sync_with_master (and sync_slave_with_master), if MASTER_POS_WAIT() returns NULL, it may be that the slave SQL thread did not have time to start yes, so we sleep 1 sec and retry, 4 times at most. mysql-test/r/rpl_server_id2.result: result update mysql-test/t/rpl_server_id2.test: master_slave.inc already drops the table sql/slave.cc: gcc compiler complained that the default value of skip_lock was specified in slave.h AND slave.cc
This commit is contained in:
parent
177922377e
commit
8d18ae3986
@ -1097,7 +1097,7 @@ int do_sync_with_master2(const char* p)
|
||||
MYSQL_ROW row;
|
||||
MYSQL* mysql = &cur_con->mysql;
|
||||
char query_buf[FN_REFLEN+128];
|
||||
int offset = 0;
|
||||
int offset= 0, tries= 0;
|
||||
int rpl_parse;
|
||||
|
||||
if (!master_pos.file[0])
|
||||
@ -1112,6 +1112,9 @@ int do_sync_with_master2(const char* p)
|
||||
|
||||
sprintf(query_buf, "select master_pos_wait('%s', %ld)", master_pos.file,
|
||||
master_pos.pos + offset);
|
||||
|
||||
wait_for_position:
|
||||
|
||||
if (mysql_query(mysql, query_buf))
|
||||
die("line %u: failed in %s: %d: %s", start_lineno, query_buf,
|
||||
mysql_errno(mysql), mysql_error(mysql));
|
||||
@ -1122,8 +1125,20 @@ int do_sync_with_master2(const char* p)
|
||||
if (!(row = mysql_fetch_row(res)))
|
||||
die("line %u: empty result in %s", start_lineno, query_buf);
|
||||
if (!row[0])
|
||||
die("line %u: could not sync with master ('%s' returned NULL)",
|
||||
start_lineno, query_buf);
|
||||
{
|
||||
/*
|
||||
It may be that the slave SQL thread has not started yet, though START
|
||||
SLAVE has been issued ?
|
||||
*/
|
||||
if (tries++ == 3)
|
||||
{
|
||||
die("line %u: could not sync with master ('%s' returned NULL)",
|
||||
start_lineno, query_buf);
|
||||
}
|
||||
sleep(1); /* So at most we will wait 3 seconds and make 4 tries */
|
||||
mysql_free_result(res);
|
||||
goto wait_for_position;
|
||||
}
|
||||
mysql_free_result(res);
|
||||
last_result=0;
|
||||
if (rpl_parse)
|
||||
|
@ -4,16 +4,13 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
create table t1 (n int);
|
||||
reset master;
|
||||
stop slave;
|
||||
change master to master_port=SLAVE_PORT;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 4 None 0 No NULL
|
||||
127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 95 None 0 No NULL
|
||||
start slave;
|
||||
insert into t1 values (1);
|
||||
select * from t1;
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
source include/master-slave.inc;
|
||||
connection slave;
|
||||
drop table if exists t1;
|
||||
create table t1 (n int);
|
||||
reset master;
|
||||
# replicate ourselves
|
||||
|
@ -465,7 +465,7 @@ void init_slave_skip_errors(const char* arg)
|
||||
|
||||
|
||||
void st_relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
|
||||
bool skip_lock=0)
|
||||
bool skip_lock)
|
||||
{
|
||||
if (!skip_lock)
|
||||
pthread_mutex_lock(&data_lock);
|
||||
@ -3046,7 +3046,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
|
||||
|
||||
if ((ev->server_id == (uint32) ::server_id &&
|
||||
!replicate_same_server_id &&
|
||||
type_code!= FORMAT_DESCRIPTION_EVENT) ||
|
||||
type_code != FORMAT_DESCRIPTION_EVENT) ||
|
||||
(rli->slave_skip_counter &&
|
||||
type_code != ROTATE_EVENT && type_code != STOP_EVENT &&
|
||||
type_code != START_EVENT_V3 && type_code!= FORMAT_DESCRIPTION_EVENT))
|
||||
|
Loading…
x
Reference in New Issue
Block a user