Commit 49915eb8 authored by aelkin/andrei@mysql1000.(none)'s avatar aelkin/andrei@mysql1000.(none)

Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl

into  mysql1000.(none):/home/andrei/MySQL/FIXES/5.1/bug31316-sss_server_id_clashes
parents 759d2f66 7e93d94c
...@@ -4,10 +4,11 @@ reset master; ...@@ -4,10 +4,11 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
create table t1 (n int);
reset master; reset master;
stop slave; stop slave;
change master to master_port=SLAVE_PORT; change master to master_port=SLAVE_PORT;
start slave;
*** must be having the replicate-same-server-id IO thread error ***
show slave status; show slave status;
Slave_IO_State Slave_IO_State
Master_Host 127.0.0.1 Master_Host 127.0.0.1
...@@ -20,15 +21,15 @@ Relay_Log_File slave-relay-bin.000001 ...@@ -20,15 +21,15 @@ Relay_Log_File slave-relay-bin.000001
Relay_Log_Pos 4 Relay_Log_Pos 4
Relay_Master_Log_File Relay_Master_Log_File
Slave_IO_Running No Slave_IO_Running No
Slave_SQL_Running No Slave_SQL_Running #
Replicate_Do_DB Replicate_Do_DB
Replicate_Ignore_DB Replicate_Ignore_DB
Replicate_Do_Table Replicate_Do_Table
Replicate_Ignore_Table # Replicate_Ignore_Table #
Replicate_Wild_Do_Table Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table # Replicate_Wild_Ignore_Table #
Last_Errno 0 Last_Errno #
Last_Error Last_Error #
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 0 Exec_Master_Log_Pos 0
Relay_Log_Space 106 Relay_Log_Space 106
...@@ -43,13 +44,7 @@ Master_SSL_Cipher ...@@ -43,13 +44,7 @@ Master_SSL_Cipher
Master_SSL_Key Master_SSL_Key
Seconds_Behind_Master NULL Seconds_Behind_Master NULL
Master_SSL_Verify_Server_Cert No Master_SSL_Verify_Server_Cert No
Last_IO_Errno # Last_IO_Errno 1593
Last_IO_Error # Last_IO_Error Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
Last_SQL_Errno 0 Last_SQL_Errno #
Last_SQL_Error Last_SQL_Error #
start slave;
insert into t1 values (1);
show status like "slave_running";
Variable_name Value
Slave_running OFF
drop table t1;
...@@ -6,21 +6,20 @@ ...@@ -6,21 +6,20 @@
source include/master-slave.inc; source include/master-slave.inc;
connection slave; connection slave;
create table t1 (n int);
reset master; reset master;
# replicate ourselves # replicate ourselves
stop slave; stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT; eval change master to master_port=$SLAVE_MYPORT;
start slave;
--echo *** must be having the replicate-same-server-id IO thread error ***
source include/wait_for_slave_io_to_stop.inc;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
--replace_column 16 # 18 # 35 # 36 # --replace_column 12 # 16 # 19 # 20 # 18 # 37 # 38 #
query_vertical show slave status; query_vertical show slave status;
start slave;
insert into t1 values (1);
# can't MASTER_POS_WAIT(), it does not work in this weird setup
# (when slave is its own master without --replicate-same-server-id)
sleep 2; # enough time for the event to be replicated (it should not)
show status like "slave_running";
drop table t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -747,7 +747,11 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) ...@@ -747,7 +747,11 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val)
static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
{ {
char err_buff[MAX_SLAVE_ERRMSG];
const char* errmsg= 0; const char* errmsg= 0;
int err_code= 0;
MYSQL_RES *master_res= 0;
MYSQL_ROW master_row;
DBUG_ENTER("get_master_version_and_clock"); DBUG_ENTER("get_master_version_and_clock");
/* /*
...@@ -758,7 +762,11 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) ...@@ -758,7 +762,11 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
mi->rli.relay_log.description_event_for_queue= 0; mi->rli.relay_log.description_event_for_queue= 0;
if (!my_isdigit(&my_charset_bin,*mysql->server_version)) if (!my_isdigit(&my_charset_bin,*mysql->server_version))
{
errmsg = "Master reported unrecognized MySQL version"; errmsg = "Master reported unrecognized MySQL version";
err_code= ER_SLAVE_FATAL_ERROR;
sprintf(err_buff, ER(err_code), errmsg);
}
else else
{ {
/* /*
...@@ -770,6 +778,8 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) ...@@ -770,6 +778,8 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
case '1': case '1':
case '2': case '2':
errmsg = "Master reported unrecognized MySQL version"; errmsg = "Master reported unrecognized MySQL version";
err_code= ER_SLAVE_FATAL_ERROR;
sprintf(err_buff, ER(err_code), errmsg);
break; break;
case '3': case '3':
mi->rli.relay_log.description_event_for_queue= new mi->rli.relay_log.description_event_for_queue= new
...@@ -802,26 +812,21 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) ...@@ -802,26 +812,21 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
*/ */
if (errmsg) if (errmsg)
{ goto err;
sql_print_error(errmsg);
DBUG_RETURN(1);
}
/* as we are here, we tried to allocate the event */ /* as we are here, we tried to allocate the event */
if (!mi->rli.relay_log.description_event_for_queue) if (!mi->rli.relay_log.description_event_for_queue)
{ {
mi->report(ERROR_LEVEL, ER_SLAVE_CREATE_EVENT_FAILURE, errmsg= "default Format_description_log_event";
ER(ER_SLAVE_CREATE_EVENT_FAILURE), err_code= ER_SLAVE_CREATE_EVENT_FAILURE;
"default Format_description_log_event"); sprintf(err_buff, ER(err_code), errmsg);
DBUG_RETURN(1); goto err;
} }
/* /*
Compare the master and slave's clock. Do not die if master's clock is Compare the master and slave's clock. Do not die if master's clock is
unavailable (very old master not supporting UNIX_TIMESTAMP()?). unavailable (very old master not supporting UNIX_TIMESTAMP()?).
*/ */
MYSQL_RES *master_res= 0;
MYSQL_ROW master_row;
if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) && if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) &&
(master_res= mysql_store_result(mysql)) && (master_res= mysql_store_result(mysql)) &&
...@@ -858,11 +863,17 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) ...@@ -858,11 +863,17 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
if ((master_row= mysql_fetch_row(master_res)) && if ((master_row= mysql_fetch_row(master_res)) &&
(::server_id == strtoul(master_row[1], 0, 10)) && (::server_id == strtoul(master_row[1], 0, 10)) &&
!mi->rli.replicate_same_server_id) !mi->rli.replicate_same_server_id)
{
errmsg= "The slave I/O thread stops because master and slave have equal \ errmsg= "The slave I/O thread stops because master and slave have equal \
MySQL server ids; these ids must be different for replication to work (or \ MySQL server ids; these ids must be different for replication to work (or \
the --replicate-same-server-id option must be used on slave but this does \ the --replicate-same-server-id option must be used on slave but this does \
not always make sense; please check the manual before using it)."; not always make sense; please check the manual before using it).";
err_code= ER_SLAVE_FATAL_ERROR;
sprintf(err_buff, ER(err_code), errmsg);
}
mysql_free_result(master_res); mysql_free_result(master_res);
if (errmsg)
goto err;
} }
/* /*
...@@ -893,10 +904,16 @@ not always make sense; please check the manual before using it)."; ...@@ -893,10 +904,16 @@ not always make sense; please check the manual before using it).";
{ {
if ((master_row= mysql_fetch_row(master_res)) && if ((master_row= mysql_fetch_row(master_res)) &&
strcmp(master_row[0], global_system_variables.collation_server->name)) strcmp(master_row[0], global_system_variables.collation_server->name))
{
errmsg= "The slave I/O thread stops because master and slave have \ errmsg= "The slave I/O thread stops because master and slave have \
different values for the COLLATION_SERVER global variable. The values must \ different values for the COLLATION_SERVER global variable. The values must \
be equal for replication to work"; be equal for replication to work";
err_code= ER_SLAVE_FATAL_ERROR;
sprintf(err_buff, ER(err_code), errmsg);
}
mysql_free_result(master_res); mysql_free_result(master_res);
if (errmsg)
goto err;
} }
/* /*
...@@ -921,16 +938,24 @@ be equal for replication to work"; ...@@ -921,16 +938,24 @@ be equal for replication to work";
if ((master_row= mysql_fetch_row(master_res)) && if ((master_row= mysql_fetch_row(master_res)) &&
strcmp(master_row[0], strcmp(master_row[0],
global_system_variables.time_zone->get_name()->ptr())) global_system_variables.time_zone->get_name()->ptr()))
{
errmsg= "The slave I/O thread stops because master and slave have \ errmsg= "The slave I/O thread stops because master and slave have \
different values for the TIME_ZONE global variable. The values must \ different values for the TIME_ZONE global variable. The values must \
be equal for replication to work"; be equal for replication to work";
err_code= ER_SLAVE_FATAL_ERROR;
sprintf(err_buff, ER(err_code), errmsg);
}
mysql_free_result(master_res); mysql_free_result(master_res);
if (errmsg)
goto err;
} }
err: err:
if (errmsg) if (errmsg)
{ {
sql_print_error(errmsg); DBUG_ASSERT(err_code != 0);
mi->report(ERROR_LEVEL, err_code, err_buff);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment