Commit 668ddf17 authored by unknown's avatar unknown

Merge work:/home/bk/mysql-4.0

into mysql.sashanet.com:/reiser-data/mysql-4.0


sql/mysqld.cc:
  Auto merged
parents a2ce6c71 74fccd18
...@@ -8,7 +8,7 @@ File Position Binlog_do_db Binlog_ignore_db ...@@ -8,7 +8,7 @@ File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79 master-bin.001 79
show slave status; show slave status;
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 124 127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 128
change master to master_log_pos=73; change master to master_log_pos=73;
slave stop; slave stop;
change master to master_log_pos=73; change master to master_log_pos=73;
......
...@@ -75,7 +75,7 @@ slave-bin.002 115 Query 1 62 use test; insert into t1 values (1) ...@@ -75,7 +75,7 @@ slave-bin.002 115 Query 1 62 use test; insert into t1 values (1)
slave-bin.002 175 Query 1 122 use test; drop table t1 slave-bin.002 175 Query 1 122 use test; drop table t1
show slave status; show slave status;
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 916 master-bin.002 Yes Yes 0 0 170 920 127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 916 master-bin.002 Yes Yes 0 0 170 924
show new master for slave with master_log_file='master-bin.001' and show new master for slave with master_log_file='master-bin.001' and
master_log_pos=4 and master_server_id=1; master_log_pos=4 and master_server_id=1;
Log_name Log_pos Log_name Log_pos
......
...@@ -227,6 +227,11 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO; ...@@ -227,6 +227,11 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO;
#endif #endif
bool opt_skip_slave_start = 0; // If set, slave is not autostarted bool opt_skip_slave_start = 0; // If set, slave is not autostarted
/* if set, some standard measures to enforce
slave data intergity will not be performed
*/
bool opt_reckless_slave = 0;
static bool opt_do_pstack = 0; static bool opt_do_pstack = 0;
static ulong opt_specialflag=SPECIAL_ENGLISH; static ulong opt_specialflag=SPECIAL_ENGLISH;
static ulong back_log,connect_timeout,concurrency; static ulong back_log,connect_timeout,concurrency;
...@@ -2741,6 +2746,7 @@ enum options { ...@@ -2741,6 +2746,7 @@ enum options {
OPT_RPL_RECOVERY_RANK,OPT_INIT_RPL_ROLE, OPT_RPL_RECOVERY_RANK,OPT_INIT_RPL_ROLE,
OPT_RELAY_LOG, OPT_RELAY_LOG_INDEX, OPT_RELAY_LOG_INFO_FILE, OPT_RELAY_LOG, OPT_RELAY_LOG_INDEX, OPT_RELAY_LOG_INFO_FILE,
OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE, OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE,
OPT_RECKLESS_SLAVE,
OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA,
OPT_SSL_CAPATH, OPT_SSL_CIPHER OPT_SSL_CAPATH, OPT_SSL_CIPHER
}; };
...@@ -2851,6 +2857,7 @@ static struct option long_options[] = { ...@@ -2851,6 +2857,7 @@ static struct option long_options[] = {
#endif #endif
{"pid-file", required_argument, 0, (int) OPT_PID_FILE}, {"pid-file", required_argument, 0, (int) OPT_PID_FILE},
{"port", required_argument, 0, 'P'}, {"port", required_argument, 0, 'P'},
{"reckless-slave", no_argument, 0, (int) OPT_RECKLESS_SLAVE},
{"replicate-do-db", required_argument, 0, (int) OPT_REPLICATE_DO_DB}, {"replicate-do-db", required_argument, 0, (int) OPT_REPLICATE_DO_DB},
{"replicate-do-table", required_argument, 0, {"replicate-do-table", required_argument, 0,
(int) OPT_REPLICATE_DO_TABLE}, (int) OPT_REPLICATE_DO_TABLE},
...@@ -3941,6 +3948,10 @@ static void get_options(int argc,char **argv) ...@@ -3941,6 +3948,10 @@ static void get_options(int argc,char **argv)
opt_slow_log=1; opt_slow_log=1;
opt_slow_logname=optarg; opt_slow_logname=optarg;
break; break;
case (int)OPT_RECKLESS_SLAVE:
opt_reckless_slave = 1;
init_slave_skip_errors("all");
break;
case (int)OPT_SKIP_SLAVE_START: case (int)OPT_SKIP_SLAVE_START:
opt_skip_slave_start = 1; opt_skip_slave_start = 1;
break; break;
......
...@@ -191,11 +191,22 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log, ...@@ -191,11 +191,22 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
pos = rli->relay_log_pos; // already inited pos = rli->relay_log_pos; // already inited
else else
rli->relay_log_pos = pos; rli->relay_log_pos = pos;
if (rli->relay_log.find_first_log(&rli->linfo,log))
// test to see if the previous run was with the skip of purging
// if yes, we do not purge when we restart
if (rli->relay_log.find_first_log(&rli->linfo,""))
{ {
*errmsg="Could not find first log during relay log initialization"; *errmsg="Could not find first log during relay log initialization";
goto err; goto err;
} }
if (strcmp(log,rli->linfo.log_file_name))
rli->skip_log_purge=1;
if (rli->relay_log.find_first_log(&rli->linfo,log))
{
*errmsg="Could not find target log during relay log initialization";
goto err;
}
strnmov(rli->relay_log_name,rli->linfo.log_file_name, strnmov(rli->relay_log_name,rli->linfo.log_file_name,
sizeof(rli->relay_log_name)); sizeof(rli->relay_log_name));
// to make end_io_cache(&rli->cache_buf) safe in all cases // to make end_io_cache(&rli->cache_buf) safe in all cases
...@@ -2497,6 +2508,15 @@ Log_event* next_event(RELAY_LOG_INFO* rli) ...@@ -2497,6 +2508,15 @@ Log_event* next_event(RELAY_LOG_INFO* rli)
return ev; return ev;
} }
DBUG_ASSERT(thd==rli->sql_thd); DBUG_ASSERT(thd==rli->sql_thd);
if (opt_reckless_slave)
cur_log->error = 0;
if ( cur_log->error < 0)
{
errmsg = "slave SQL thread aborted because of I/O error";
goto err;
}
if (!cur_log->error) /* EOF */ if (!cur_log->error) /* EOF */
{ {
/* /*
...@@ -2605,12 +2625,12 @@ event(errno=%d,cur_log->error=%d)", ...@@ -2605,12 +2625,12 @@ event(errno=%d,cur_log->error=%d)",
my_errno,cur_log->error); my_errno,cur_log->error);
// set read position to the beginning of the event // set read position to the beginning of the event
my_b_seek(cur_log,rli->relay_log_pos+rli->pending); my_b_seek(cur_log,rli->relay_log_pos+rli->pending);
// no need to hog the mutex while we sleep /* otherwise, we have had a partial read */
pthread_mutex_unlock(&rli->data_lock); /* TODO; see if there is a way to do this without this goto */
safe_sleep(rli->sql_thd,1,(CHECK_KILLED_FUNC)sql_slave_killed, errmsg = "Aborting slave SQL thread because of partial event read";
(void*)rli); goto err;
pthread_mutex_lock(&rli->data_lock);
} }
} }
if (!errmsg && was_killed) if (!errmsg && was_killed)
errmsg = "slave SQL thread was killed"; errmsg = "slave SQL thread was killed";
......
...@@ -30,7 +30,7 @@ extern bool use_slave_mask; ...@@ -30,7 +30,7 @@ extern bool use_slave_mask;
extern char* slave_load_tmpdir; extern char* slave_load_tmpdir;
extern my_string master_info_file,relay_log_info_file; extern my_string master_info_file,relay_log_info_file;
extern my_string opt_relay_logname, opt_relaylog_index_name; extern my_string opt_relay_logname, opt_relaylog_index_name;
extern bool opt_skip_slave_start; extern bool opt_skip_slave_start, opt_reckless_slave;
extern ulong relay_log_space_limit; extern ulong relay_log_space_limit;
struct st_master_info; struct st_master_info;
......
This diff is collapsed.
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