summaryrefslogtreecommitdiff
path: root/sql/slave.h
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/slave.h
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/slave.h')
-rw-r--r--sql/slave.h35
1 files changed, 19 insertions, 16 deletions
diff --git a/sql/slave.h b/sql/slave.h
index e6a5e86bb10..c59ab03c275 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -139,6 +139,14 @@ typedef struct st_relay_log_info
ulonglong log_space_limit,log_space_total;
/*
+ InnoDB internally stores the master log position it has processed
+ so far; the position to store is really the sum of
+ pos + pending + event_len here since we must store the pos of the
+ END of the current log event
+ */
+ int event_len;
+
+ /*
Needed for problems when slave stops and we want to restart it
skipping one or more events in the master log that have caused
errors, and have been manually applied by DBA already.
@@ -167,6 +175,7 @@ typedef struct st_relay_log_info
{
relay_log_name[0] = master_log_name[0] = 0;
bzero(&info_file,sizeof(info_file));
+ bzero(&cache_buf, sizeof(cache_buf));
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
@@ -204,7 +213,7 @@ typedef struct st_relay_log_info
}
/*
thread safe read of position - not needed if we are in the slave thread,
- but required otherwise
+ but required otherwise as var is a longlong
*/
inline void read_pos(ulonglong& var)
{
@@ -216,6 +225,7 @@ typedef struct st_relay_log_info
int wait_for_pos(THD* thd, String* log_name, ulonglong log_pos);
} RELAY_LOG_INFO;
+
Log_event* next_event(RELAY_LOG_INFO* rli);
/*
@@ -251,16 +261,7 @@ typedef struct st_master_info
char master_log_name[FN_REFLEN];
my_off_t master_log_pos;
- File fd;
-
- /*
- InnoDB internally stores the master log position it has processed
- so far; the position to store is really the sum of
- pos + pending + event_len here since we must store the pos of the
- END of the current log event
-*/
- int event_len;
- File fd;
+ File fd; // we keep the file open, so we need to remember the file pointer
IO_CACHE file;
/* the variables below are needed because we can change masters on the fly */
@@ -288,7 +289,7 @@ typedef struct st_master_info
slave_running(0)
{
host[0] = 0; user[0] = 0; password[0] = 0;
- bzero(&file,sizeof(file));
+ bzero(&file, sizeof(file));
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
pthread_cond_init(&data_cond, NULL);
@@ -337,8 +338,8 @@ typedef struct st_table_rule_ent
int init_slave();
void init_slave_skip_errors(const char* arg);
-int flush_master_info(MASTER_INFO* mi);
-int flush_relay_log_info(RELAY_LOG_INFO* rli);
+bool flush_master_info(MASTER_INFO* mi);
+bool flush_relay_log_info(RELAY_LOG_INFO* rli);
int register_slave_on_master(MYSQL* mysql);
int terminate_slave_threads(MASTER_INFO* mi, int thread_mask,
bool skip_lock = 0);
@@ -393,7 +394,8 @@ void slave_print_error(RELAY_LOG_INFO* rli,int err_code, const char* msg, ...);
void end_slave(); /* clean up */
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
- const char* slave_info_fname);
+ const char* slave_info_fname,
+ bool abort_if_no_master_info_file);
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);
@@ -403,7 +405,8 @@ void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse);
int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,ulonglong pos,
bool need_data_lock, const char** errmsg);
-int purge_relay_logs(RELAY_LOG_INFO* rli,bool just_reset,const char** errmsg);
+int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset,
+ const char** errmsg);
extern bool opt_log_slave_updates ;
pthread_handler_decl(handle_slave_io,arg);