summaryrefslogtreecommitdiff
path: root/sql/slave.h
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-06-05 23:04:38 +0300
committerunknown <monty@hundin.mysql.fi>2002-06-05 23:04:38 +0300
commit03728196ee76cfb4bce8923ec25687f8bbd495cb (patch)
tree9260753468997c0d4b3b8c78aea517507e2791eb /sql/slave.h
parentef06010563093f231d62896c6af9e128142fbd56 (diff)
downloadmariadb-git-03728196ee76cfb4bce8923ec25687f8bbd495cb.tar.gz
removed init_count from IO_CACHE.
Added missing mutex_unlock to slave replication code. include/my_sys.h: removed init_count from IO_CACHE. General cleanup. innobase/srv/srv0srv.c: Initailize slots to avoid purify warnings. Removed some compiler warnings. mysql-test/mysql-test-run.sh: Automatic start of slave under gdb mysys/mf_iocache.c: removed init_count sql/field.cc: Cleanup sql/log.cc: Cleanup added open_count variable. sql/log_event.cc: cleanup use is_prefix instead of memcmp() sql/repl_failsafe.cc: cleanup sql/slave.cc: cleanup use MYSQL_LOG->open_count instead of IO_CACHE->init_count Added missing mutex_unlock() sql/slave.h: cleanup sql/sql_class.h: cleanup Added open_count to MYSQL_LOGL sql/sql_parse.cc: removed compiler warning sql/sql_repl.cc: added DBUG_xxx sql/unireg.h: Added BIN_LOG_HEADER_SIZE
Diffstat (limited to 'sql/slave.h')
-rw-r--r--sql/slave.h135
1 files changed, 64 insertions, 71 deletions
diff --git a/sql/slave.h b/sql/slave.h
index 16735891815..d6992a8b839 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -84,18 +84,9 @@ typedef struct st_relay_log_info
volatile my_off_t master_log_pos;
/*
- current offset in the relay log.
- pending - in some cases we do not increment offset immediately after
- processing an event, because the following event needs to be processed
- atomically together with this one ( so far, there is only one type of
- such event - Intvar_event that sets auto_increment value). However, once
- both events have been processed, we need to increment by the cumulative
- offset. pending stored the extra offset to be added to the position.
+ Protected with internal locks.
+ Must get data_lock when resetting the logs.
*/
- ulonglong relay_log_pos, pending;
-
- // protected with internal locks
- // must get data_lock when resetting the logs
MYSQL_LOG relay_log;
LOG_INFO linfo;
IO_CACHE cache_buf,*cur_log;
@@ -125,9 +116,6 @@ typedef struct st_relay_log_info
*/
pthread_cond_t start_cond, stop_cond, data_cond;
- // if not set, the value of other members of the structure are undefined
- bool inited;
-
// parent master info structure
struct st_master_info *mi;
@@ -135,9 +123,19 @@ typedef struct st_relay_log_info
Needed to deal properly with cur_log getting closed and re-opened with
a different log under our feet
*/
- int cur_log_init_count;
+ uint32 cur_log_old_open_count;
- volatile bool abort_slave, slave_running;
+ /*
+ current offset in the relay log.
+ pending - in some cases we do not increment offset immediately after
+ processing an event, because the following event needs to be processed
+ atomically together with this one ( so far, there is only one type of
+ such event - Intvar_event that sets auto_increment value). However, once
+ both events have been processed, we need to increment by the cumulative
+ offset. pending stored the extra offset to be added to the position.
+ */
+ ulonglong relay_log_pos, pending;
+ ulonglong log_space_limit,log_space_total;
/*
Needed for problems when slave stops and we want to restart it
@@ -145,45 +143,47 @@ typedef struct st_relay_log_info
errors, and have been manually applied by DBA already.
*/
volatile uint32 slave_skip_counter;
+ pthread_mutex_t log_space_lock;
+ pthread_cond_t log_space_cond;
+ THD * sql_thd;
+ int last_slave_errno;
#ifndef DBUG_OFF
int events_till_abort;
#endif
- int last_slave_errno;
char last_slave_error[MAX_SLAVE_ERRMSG];
- THD* sql_thd;
+
+ // if not set, the value of other members of the structure are undefined
+ bool inited;
+ volatile bool abort_slave, slave_running;
bool log_pos_current;
bool abort_pos_wait;
bool skip_log_purge;
- ulonglong log_space_limit,log_space_total;
- pthread_mutex_t log_space_lock;
- pthread_cond_t log_space_cond;
- st_relay_log_info():info_fd(-1),cur_log_fd(-1),inited(0),
- cur_log_init_count(0),
- abort_slave(0),slave_running(0),
- log_pos_current(0),abort_pos_wait(0),
- skip_log_purge(0)
- {
- relay_log_name[0] = master_log_name[0] = 0;
- bzero(&info_file,sizeof(info_file));
- 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);
- pthread_cond_init(&data_cond, NULL);
- pthread_cond_init(&start_cond, NULL);
- pthread_cond_init(&stop_cond, NULL);
- pthread_cond_init(&log_space_cond, NULL);
- }
+ st_relay_log_info()
+ :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0),
+ inited(0), abort_slave(0), slave_running(0), log_pos_current(0),
+ abort_pos_wait(0), skip_log_purge(0)
+ {
+ relay_log_name[0] = master_log_name[0] = 0;
+ bzero(&info_file,sizeof(info_file));
+ 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);
+ pthread_cond_init(&data_cond, NULL);
+ pthread_cond_init(&start_cond, NULL);
+ pthread_cond_init(&stop_cond, NULL);
+ pthread_cond_init(&log_space_cond, NULL);
+ }
~st_relay_log_info()
- {
- pthread_mutex_destroy(&run_lock);
- pthread_mutex_destroy(&data_lock);
- pthread_mutex_destroy(&log_space_lock);
- pthread_cond_destroy(&data_cond);
- pthread_cond_destroy(&start_cond);
- pthread_cond_destroy(&stop_cond);
- pthread_cond_destroy(&log_space_cond);
- }
+ {
+ pthread_mutex_destroy(&run_lock);
+ pthread_mutex_destroy(&data_lock);
+ pthread_mutex_destroy(&log_space_lock);
+ pthread_cond_destroy(&data_cond);
+ pthread_cond_destroy(&start_cond);
+ pthread_cond_destroy(&stop_cond);
+ pthread_cond_destroy(&log_space_cond);
+ }
inline void inc_pending(ulonglong val)
{
pending += val;
@@ -215,40 +215,33 @@ typedef struct st_relay_log_info
int wait_for_pos(THD* thd, String* log_name, ulonglong log_pos);
} RELAY_LOG_INFO;
-/*
- repopen_relay_log() is called when we notice that the current "hot" log
- got rotated under our feet
-*/
-
-IO_CACHE* reopen_relay_log(RELAY_LOG_INFO* rli, const char** errmsg);
Log_event* next_event(RELAY_LOG_INFO* rli);
-
/*
st_master_info contains information about how to connect to a master,
- current master log name, and current log offset, as well as misc
- control variables
+ current master log name, and current log offset, as well as misc
+ control variables
- st_master_info is initialized once from the master.info file if such
- exists. Otherwise, data members corresponding to master.info fields are
- initialized with defaults specified by master-* options. The initialization
- is done through init_master_info() call.
+ st_master_info is initialized once from the master.info file if such
+ exists. Otherwise, data members corresponding to master.info fields
+ are initialized with defaults specified by master-* options. The
+ initialization is done through init_master_info() call.
- The format of master.info file:
+ The format of master.info file:
- log_name
- log_pos
- master_host
- master_user
- master_pass
- master_port
- master_connect_retry
+ log_name
+ log_pos
+ master_host
+ master_user
+ master_pass
+ master_port
+ master_connect_retry
- To write out the contents of master.info file to disk ( needed every
- time we read and queue data from the master ), a call to
- flush_master_info() is required.
+ To write out the contents of master.info file to disk ( needed every
+ time we read and queue data from the master ), a call to
+ flush_master_info() is required.
- To clean up, call end_master_info()
+ To clean up, call end_master_info()
*/