summaryrefslogtreecommitdiff
path: root/sql/repl_failsafe.cc
diff options
context:
space:
mode:
authormonty@mashka.mysql.fi <>2002-08-08 03:12:02 +0300
committermonty@mashka.mysql.fi <>2002-08-08 03:12:02 +0300
commit2c4fa340cccbf11dc7b7f944cf7ca30af48edf4f (patch)
treec44ce89903320c9d19cd6fe9767f75d997d2a1d0 /sql/repl_failsafe.cc
parentbc035c71f1d94649253e4dac5fb8e5c981c7d834 (diff)
downloadmariadb-git-2c4fa340cccbf11dc7b7f944cf7ca30af48edf4f.tar.gz
Lots of code fixes to the replication code (especially the binary logging and index log file handling)
Fixed bugs in my last changeset that made MySQL hard to compile. Added mutex around some data that could cause table cache corruptions when using OPTIMIZE TABLE / REPAIR TABLE or automatic repair of MyISAM tables. Added mutex around some data in the slave start/stop code that could cause THD linked list corruptions Extended my_chsize() to allow one to specify a filler character. Extend vio_blocking to return the old state (This made some usage of this function much simpler) Added testing for some functions that they caller have got the required mutexes before calling the function. Use setrlimit() to ensure that we can write core file if one specifies --core-file. Added --slave-compressed-protocol Made 2 the minimum length for ft_min_word_len Added variables foreign_key_checks & unique_checks. Less logging from replication code (if not started with --log-warnings) Changed that SHOW INNODB STATUS requre the SUPER privilege More DBUG statements and a lot of new code comments
Diffstat (limited to 'sql/repl_failsafe.cc')
-rw-r--r--sql/repl_failsafe.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index f5f5b2de9fc..54843f1dfa4 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -240,7 +240,7 @@ static int find_target_pos(LEX_MASTER_INFO *mi, IO_CACHE *log, char *errmsg)
int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg)
{
LOG_INFO linfo;
- char search_file_name[FN_REFLEN],last_log_name[FN_REFLEN];
+ char last_log_name[FN_REFLEN];
IO_CACHE log;
File file = -1, last_file = -1;
pthread_mutex_t *log_lock;
@@ -264,9 +264,8 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg)
}
linfo.index_file_offset = 0;
- search_file_name[0] = 0;
- if (mysql_bin_log.find_first_log(&linfo, search_file_name))
+ if (mysql_bin_log.find_log_pos(&linfo, NullS))
{
strmov(errmsg,"Could not find first log");
return 1;
@@ -619,18 +618,22 @@ int show_slave_hosts(THD* thd)
int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
{
- if (!mi->host || !*mi->host) /* empty host */
- return 1;
+ DBUG_ENTER("connect_to_master");
+ if (!mi->host || !*mi->host) /* empty host */
+ {
+ DBUG_PRINT("error",("empty hostname"));
+ DBUG_RETURN(1);
+ }
if (!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
mi->port, 0, 0,
slave_net_timeout))
{
sql_print_error("Connection to master failed: %s",
mc_mysql_error(mysql));
- return 1;
+ DBUG_RETURN(1);
}
- return 0;
+ DBUG_RETURN(0);
}
@@ -671,12 +674,17 @@ static inline int fetch_db_tables(THD* thd, MYSQL* mysql, const char* db,
return 0;
}
+/*
+ Load all MyISAM tables from master to this slave.
+
+ REQUIREMENTS
+ - No active transaction (flush_relay_log_info would not work in this case)
+*/
int load_master_data(THD* thd)
{
MYSQL mysql;
MYSQL_RES* master_status_res = 0;
- bool slave_was_running = 0;
int error = 0;
const char* errmsg=0;
int restart_thread_mask;
@@ -840,7 +848,8 @@ int load_master_data(THD* thd)
}
}
thd->proc_info="purging old relay logs";
- if (purge_relay_logs(&active_mi->rli,0 /* not only reset, but also reinit */,
+ if (purge_relay_logs(&active_mi->rli,thd,
+ 0 /* not only reset, but also reinit */,
&errmsg))
{
send_error(&thd->net, 0, "Failed purging old relay logs");