diff options
author | unknown <mats@kindahl-laptop.dnsalias.net> | 2007-08-16 08:52:50 +0200 |
---|---|---|
committer | unknown <mats@kindahl-laptop.dnsalias.net> | 2007-08-16 08:52:50 +0200 |
commit | 9a7658a3c25f03417580b92e93591864e9e32ed6 (patch) | |
tree | 5b834668a43070a4ce118cd314f79d229abc5a76 /sql | |
parent | 044a4a3e06fb8019e2af1fb6a8c9f783c1a407cf (diff) | |
download | mariadb-git-9a7658a3c25f03417580b92e93591864e9e32ed6.tar.gz |
Renaming MASTER_INFO to Master_info in order to follow the coding
standards (and help Doxygen generating good documentation).
sql/ha_ndbcluster.cc:
Renaming MASTER_INFO to Master_info.
sql/log_event.cc:
Renaming MASTER_INFO to Master_info.
sql/repl_failsafe.cc:
Renaming MASTER_INFO to Master_info.
sql/repl_failsafe.h:
Renaming MASTER_INFO to Master_info.
sql/rpl_mi.cc:
Renaming MASTER_INFO to Master_info.
sql/rpl_mi.h:
Renaming MASTER_INFO to Master_info.
sql/rpl_rli.h:
Renaming MASTER_INFO to Master_info.
sql/slave.cc:
Renaming MASTER_INFO to Master_info.
sql/slave.h:
Renaming MASTER_INFO to Master_info.
sql/sql_repl.cc:
Renaming MASTER_INFO to Master_info.
sql/sql_repl.h:
Renaming MASTER_INFO to Master_info.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_ndbcluster.cc | 2 | ||||
-rw-r--r-- | sql/log_event.cc | 2 | ||||
-rw-r--r-- | sql/repl_failsafe.cc | 6 | ||||
-rw-r--r-- | sql/repl_failsafe.h | 4 | ||||
-rw-r--r-- | sql/rpl_mi.cc | 12 | ||||
-rw-r--r-- | sql/rpl_mi.h | 18 | ||||
-rw-r--r-- | sql/rpl_rli.h | 4 | ||||
-rw-r--r-- | sql/slave.cc | 84 | ||||
-rw-r--r-- | sql/slave.h | 32 | ||||
-rw-r--r-- | sql/sql_repl.cc | 8 | ||||
-rw-r--r-- | sql/sql_repl.h | 10 |
11 files changed, 91 insertions, 91 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 48712600e79..ca004ecc284 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -4287,7 +4287,7 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd, */ #ifdef HAVE_NDB_BINLOG -extern MASTER_INFO *active_mi; +extern Master_info *active_mi; static int ndbcluster_update_apply_status(THD *thd, int do_update) { Thd_ndb *thd_ndb= get_thd_ndb(thd); diff --git a/sql/log_event.cc b/sql/log_event.cc index 3432538f70b..a5f0065861f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -4462,7 +4462,7 @@ Slave_log_event::Slave_log_event(THD* thd_arg, if (!rli->inited) // QQ When can this happen ? DBUG_VOID_RETURN; - MASTER_INFO* mi = rli->mi; + Master_info* mi = rli->mi; // TODO: re-write this better without holding both locks at the same time pthread_mutex_lock(&mi->data_lock); pthread_mutex_lock(&rli->data_lock); diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 8bab1ff1ca3..834d87532af 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -492,7 +492,7 @@ bool show_new_master(THD* thd) 0 success */ -int update_slave_list(MYSQL* mysql, MASTER_INFO* mi) +int update_slave_list(MYSQL* mysql, Master_info* mi) { MYSQL_RES* res=0; MYSQL_ROW row; @@ -679,7 +679,7 @@ bool show_slave_hosts(THD* thd) } -int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi) +int connect_to_master(THD *thd, MYSQL* mysql, Master_info* mi) { DBUG_ENTER("connect_to_master"); @@ -728,7 +728,7 @@ static inline void cleanup_mysql_results(MYSQL_RES* db_res, static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db, - MYSQL_RES *table_res, MASTER_INFO *mi) + MYSQL_RES *table_res, Master_info *mi) { MYSQL_ROW row; for (row = mysql_fetch_row(table_res); row; diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h index 561db00d841..6ff78067aca 100644 --- a/sql/repl_failsafe.h +++ b/sql/repl_failsafe.h @@ -33,12 +33,12 @@ extern const char* rpl_role_type[], *rpl_status_type[]; pthread_handler_t handle_failsafe_rpl(void *arg); void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status); int find_recovery_captain(THD* thd, MYSQL* mysql); -int update_slave_list(MYSQL* mysql, MASTER_INFO* mi); +int update_slave_list(MYSQL* mysql, Master_info* mi); extern HASH slave_list; bool load_master_data(THD* thd); -int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi); +int connect_to_master(THD *thd, MYSQL* mysql, Master_info* mi); bool show_new_master(THD* thd); bool show_slave_hosts(THD* thd); diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index f506a3c319d..1165164fd88 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -27,7 +27,7 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, const char *default_val); -MASTER_INFO::MASTER_INFO() +Master_info::Master_info() :Slave_reporting_capability("I/O"), ssl(0), fd(-1), io_thd(0), inited(0), abort_slave(0),slave_running(0), @@ -45,7 +45,7 @@ MASTER_INFO::MASTER_INFO() pthread_cond_init(&stop_cond, NULL); } -MASTER_INFO::~MASTER_INFO() +Master_info::~Master_info() { pthread_mutex_destroy(&run_lock); pthread_mutex_destroy(&data_lock); @@ -55,7 +55,7 @@ MASTER_INFO::~MASTER_INFO() } -void init_master_info_with_options(MASTER_INFO* mi) +void init_master_info_with_options(Master_info* mi) { DBUG_ENTER("init_master_info_with_options"); @@ -98,7 +98,7 @@ enum { LINES_IN_MASTER_INFO= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT }; -int init_master_info(MASTER_INFO* mi, const char* master_info_fname, +int init_master_info(Master_info* mi, const char* master_info_fname, const char* slave_info_fname, bool abort_if_no_master_info_file, int thread_mask) @@ -338,7 +338,7 @@ err: 1 - flush master info failed 0 - all ok */ -int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache) +int flush_master_info(Master_info* mi, bool flush_relay_log_cache) { IO_CACHE* file = &mi->file; char lbuf[22]; @@ -392,7 +392,7 @@ int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache) } -void end_master_info(MASTER_INFO* mi) +void end_master_info(Master_info* mi) { DBUG_ENTER("end_master_info"); diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 5e2326fc010..93fb0a98198 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -26,13 +26,13 @@ Replication IO Thread - MASTER_INFO contains: + Master_info contains: - information about how to connect to a master - current master log name - current master log offset - misc control variables - MASTER_INFO is initialized once from the master.info file if such + 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. @@ -55,11 +55,11 @@ *****************************************************************************/ -class MASTER_INFO : public Slave_reporting_capability +class Master_info : public Slave_reporting_capability { public: - MASTER_INFO(); - ~MASTER_INFO(); + Master_info(); + ~Master_info(); /* the variables below are needed because we can change masters on the fly */ char master_log_name[FN_REFLEN]; @@ -102,13 +102,13 @@ class MASTER_INFO : public Slave_reporting_capability long clock_diff_with_master; }; -void init_master_info_with_options(MASTER_INFO* mi); -int init_master_info(MASTER_INFO* mi, const char* master_info_fname, +void init_master_info_with_options(Master_info* mi); +int init_master_info(Master_info* mi, const char* master_info_fname, const char* slave_info_fname, bool abort_if_no_master_info_file, int thread_mask); -void end_master_info(MASTER_INFO* mi); -int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache); +void end_master_info(Master_info* mi); +int flush_master_info(Master_info* mi, bool flush_relay_log_cache); #endif /* HAVE_REPLICATION */ #endif /* RPL_MI_H */ diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 17b807e9882..8e5e667e6d4 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -121,8 +121,8 @@ public: */ pthread_cond_t start_cond, stop_cond, data_cond; - /* parent MASTER_INFO structure */ - class MASTER_INFO *mi; + /* parent Master_info structure */ + class Master_info *mi; /* Needed to deal properly with cur_log getting closed and re-opened with diff --git a/sql/slave.cc b/sql/slave.cc index 43382936ebe..6468f1ad710 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -33,7 +33,7 @@ #include "rpl_tblmap.h" -int queue_event(MASTER_INFO* mi,const char* buf,ulong event_len); +int queue_event(Master_info* mi,const char* buf,ulong event_len); static Log_event* next_event(Relay_log_info* rli); @@ -46,7 +46,7 @@ MY_BITMAP slave_error_mask; typedef bool (*CHECK_KILLED_FUNC)(THD*,void*); char* slave_load_tmpdir = 0; -MASTER_INFO *active_mi= 0; +Master_info *active_mi= 0; my_bool replicate_same_server_id; ulonglong relay_log_space_limit = 0; @@ -54,7 +54,7 @@ ulonglong relay_log_space_limit = 0; When slave thread exits, we need to remember the temporary tables so we can re-use them on slave start. - TODO: move the vars below under MASTER_INFO + TODO: move the vars below under Master_info */ int disconnect_slave_event_count = 0, abort_slave_event_count = 0; @@ -114,23 +114,23 @@ failed read" typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE; -static int process_io_rotate(MASTER_INFO* mi, Rotate_log_event* rev); -static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev); +static int process_io_rotate(Master_info* mi, Rotate_log_event* rev); +static int process_io_create_file(Master_info* mi, Create_file_log_event* cev); static bool wait_for_relay_log_space(Relay_log_info* rli); -static inline bool io_slave_killed(THD* thd,MASTER_INFO* mi); +static inline bool io_slave_killed(THD* thd,Master_info* mi); static inline bool sql_slave_killed(THD* thd,Relay_log_info* rli); static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type); -static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi); -static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi, +static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi); +static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi, bool suppress_warnings); -static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi, +static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, bool reconnect, bool suppress_warnings); static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, void* thread_killed_arg); static int request_table_dump(MYSQL* mysql, const char* db, const char* table); static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, const char* table_name, bool overwrite); -static int get_master_version_and_clock(MYSQL* mysql, MASTER_INFO* mi); +static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi); static Log_event* next_event(Relay_log_info* rli); /* @@ -151,7 +151,7 @@ static Log_event* next_event(Relay_log_info* rli); If inverse == 1, stopped threads */ -void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse) +void init_thread_mask(int* mask,Master_info* mi,bool inverse) { bool set_io = mi->slave_running, set_sql = mi->rli.slave_running; register int tmp_mask=0; @@ -172,7 +172,7 @@ void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse) lock_slave_threads() */ -void lock_slave_threads(MASTER_INFO* mi) +void lock_slave_threads(Master_info* mi) { DBUG_ENTER("lock_slave_threads"); @@ -187,7 +187,7 @@ void lock_slave_threads(MASTER_INFO* mi) unlock_slave_threads() */ -void unlock_slave_threads(MASTER_INFO* mi) +void unlock_slave_threads(Master_info* mi) { DBUG_ENTER("unlock_slave_threads"); @@ -214,7 +214,7 @@ int init_slave() TODO: re-write this to interate through the list of files for multi-master */ - active_mi= new MASTER_INFO; + active_mi= new Master_info; /* If master_host is not specified, try to read it from the master_info file. @@ -304,7 +304,7 @@ void init_slave_skip_errors(const char* arg) } -int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock) +int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) { DBUG_ENTER("terminate_slave_threads"); @@ -393,7 +393,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, pthread_cond_t *start_cond, volatile uint *slave_running, volatile ulong *slave_run_id, - MASTER_INFO* mi, + Master_info* mi, bool high_priority) { pthread_t th; @@ -463,7 +463,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, */ int start_slave_threads(bool need_slave_mutex, bool wait_for_start, - MASTER_INFO* mi, const char* master_info_fname, + Master_info* mi, const char* master_info_fname, const char* slave_info_fname, int thread_mask) { pthread_mutex_t *lock_io=0,*lock_sql=0,*lock_cond_io=0,*lock_cond_sql=0; @@ -503,7 +503,7 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start, #ifdef NOT_USED_YET -static int end_slave_on_walk(MASTER_INFO* mi, uchar* /*unused*/) +static int end_slave_on_walk(Master_info* mi, uchar* /*unused*/) { DBUG_ENTER("end_slave_on_walk"); @@ -549,7 +549,7 @@ void end_slave() } -static bool io_slave_killed(THD* thd, MASTER_INFO* mi) +static bool io_slave_killed(THD* thd, Master_info* mi) { DBUG_ENTER("io_slave_killed"); @@ -699,7 +699,7 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) 1 error */ -static int get_master_version_and_clock(MYSQL* mysql, MASTER_INFO* mi) +static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) { const char* errmsg= 0; DBUG_ENTER("get_master_version_and_clock"); @@ -1018,7 +1018,7 @@ err: int fetch_master_table(THD *thd, const char *db_name, const char *table_name, - MASTER_INFO *mi, MYSQL *mysql, bool overwrite) + Master_info *mi, MYSQL *mysql, bool overwrite) { int error= 1; const char *errmsg=0; @@ -1076,7 +1076,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, static bool wait_for_relay_log_space(Relay_log_info* rli) { bool slave_killed=0; - MASTER_INFO* mi = rli->mi; + Master_info* mi = rli->mi; const char *save_proc_info; THD* thd = mi->io_thd; DBUG_ENTER("wait_for_relay_log_space"); @@ -1108,7 +1108,7 @@ Waiting for the slave SQL thread to free enough relay log space"); ignored events' end position for the use of the slave SQL thread, by calling this function. Only that thread can call it (see assertion). */ -static void write_ignored_events_info_to_relay_log(THD *thd, MASTER_INFO *mi) +static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi) { Relay_log_info *rli= &mi->rli; pthread_mutex_t *log_lock= rli->relay_log.get_log_lock(); @@ -1151,7 +1151,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, MASTER_INFO *mi) } -int register_slave_on_master(MYSQL* mysql, MASTER_INFO *mi, +int register_slave_on_master(MYSQL* mysql, Master_info *mi, bool *suppress_warnings) { uchar buf[1024], *pos= buf; @@ -1200,7 +1200,7 @@ int register_slave_on_master(MYSQL* mysql, MASTER_INFO *mi, } -bool show_master_info(THD* thd, MASTER_INFO* mi) +bool show_master_info(THD* thd, Master_info* mi) { // TODO: fix this for multi-master List<Item> field_list; @@ -1514,7 +1514,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, } -static int request_dump(MYSQL* mysql, MASTER_INFO* mi, +static int request_dump(MYSQL* mysql, Master_info* mi, bool *suppress_warnings) { uchar buf[FN_REFLEN + 10]; @@ -1598,7 +1598,7 @@ command"); number Length of packet */ -static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings) +static ulong read_event(MYSQL* mysql, Master_info *mi, bool* suppress_warnings) { ulong len; DBUG_ENTER("read_event"); @@ -1943,7 +1943,7 @@ on this slave.\ } -static bool check_io_slave_killed(THD *thd, MASTER_INFO *mi, const char *info) +static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info) { if (io_slave_killed(thd, mi)) { @@ -1981,7 +1981,7 @@ static bool check_io_slave_killed(THD *thd, MASTER_INFO *mi, const char *info) @retval 1 There was an error. */ -static int try_to_reconnect(THD *thd, MYSQL *mysql, MASTER_INFO *mi, +static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi, uint *retry_count, bool suppress_warnings, const char *messages[SLAVE_RECON_MSG_MAX]) { @@ -2037,7 +2037,7 @@ pthread_handler_t handle_slave_io(void *arg) { THD *thd; // needs to be first for thread_stack MYSQL *mysql; - MASTER_INFO *mi = (MASTER_INFO*)arg; + Master_info *mi = (Master_info*)arg; Relay_log_info *rli= &mi->rli; char llbuff[22]; uint retry_count; @@ -2311,7 +2311,7 @@ err: /* Forget the relay log's format */ delete mi->rli.relay_log.description_event_for_queue; mi->rli.relay_log.description_event_for_queue= 0; - // TODO: make rpl_status part of MASTER_INFO + // TODO: make rpl_status part of Master_info change_rpl_status(RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE); DBUG_ASSERT(thd->net.buff != 0); net_end(&thd->net); // destructor will not free it, because net.vio is 0 @@ -2343,7 +2343,7 @@ pthread_handler_t handle_slave_sql(void *arg) THD *thd; /* needs to be first for thread_stack */ char llbuff[22],llbuff1[22]; - Relay_log_info* rli = &((MASTER_INFO*)arg)->rli; + Relay_log_info* rli = &((Master_info*)arg)->rli; const char *errmsg; // needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff @@ -2612,7 +2612,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ process_io_create_file() */ -static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) +static int process_io_create_file(Master_info* mi, Create_file_log_event* cev) { int error = 1; ulong num_bytes; @@ -2739,7 +2739,7 @@ err: */ -static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) +static int process_io_rotate(Master_info *mi, Rotate_log_event *rev) { DBUG_ENTER("process_io_rotate"); safe_mutex_assert_owner(&mi->data_lock); @@ -2787,7 +2787,7 @@ static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) Reads a 3.23 event and converts it to the slave's format. This code was copied from MySQL 4.0. */ -static int queue_binlog_ver_1_event(MASTER_INFO *mi, const char *buf, +static int queue_binlog_ver_1_event(Master_info *mi, const char *buf, ulong event_len) { const char *errmsg = 0; @@ -2905,7 +2905,7 @@ static int queue_binlog_ver_1_event(MASTER_INFO *mi, const char *buf, Reads a 4.0 event and converts it to the slave's format. This code was copied from queue_binlog_ver_1_event(), with some affordable simplifications. */ -static int queue_binlog_ver_3_event(MASTER_INFO *mi, const char *buf, +static int queue_binlog_ver_3_event(Master_info *mi, const char *buf, ulong event_len) { const char *errmsg = 0; @@ -2969,7 +2969,7 @@ err: setup with 3.23 master or 4.0 master */ -static int queue_old_event(MASTER_INFO *mi, const char *buf, +static int queue_old_event(Master_info *mi, const char *buf, ulong event_len) { DBUG_ENTER("queue_old_event"); @@ -2997,7 +2997,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, any >=5.0.0 format. */ -int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) +int queue_event(Master_info* mi,const char* buf, ulong event_len) { int error= 0; ulong inc_pos; @@ -3197,7 +3197,7 @@ void end_relay_log_info(Relay_log_info* rli) # Error */ -static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi) +static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi) { DBUG_ENTER("safe_connect"); @@ -3214,7 +3214,7 @@ static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi) master_retry_count times */ -static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi, +static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, bool reconnect, bool suppress_warnings) { int slave_was_killed; @@ -3320,7 +3320,7 @@ replication resumed in log '%s' at position %s", mi->user, master_retry_count times */ -static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi, +static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi, bool suppress_warnings) { DBUG_ENTER("safe_reconnect"); @@ -3764,7 +3764,7 @@ err: is void). */ -void rotate_relay_log(MASTER_INFO* mi) +void rotate_relay_log(Master_info* mi) { DBUG_ENTER("rotate_relay_log"); Relay_log_info* rli= &mi->rli; diff --git a/sql/slave.h b/sql/slave.h index 80ed4a6df0b..6cc0481f512 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -30,7 +30,7 @@ // Forward declarations class Relay_log_info; -class MASTER_INFO; +class Master_info; /***************************************************************************** @@ -42,7 +42,7 @@ class MASTER_INFO; I/O Thread - One of these threads is started for each master server. They maintain a connection to their master server, read log events from the master as they arrive, and queues them into - a single, shared relay log file. A MASTER_INFO + a single, shared relay log file. A Master_info represents each of these threads. SQL Thread - One of these threads is started and reads from the relay log @@ -69,18 +69,18 @@ class MASTER_INFO; mi->run_lock, keeps rli->run_lock, and tries to re-acquire mi->run_lock). Currently active_mi never moves (it's created at startup and deleted at - shutdown, and not changed: it always points to the same MASTER_INFO struct), + shutdown, and not changed: it always points to the same Master_info struct), because we don't have multimaster. So for the moment, mi does not move, and mi->rli does not either. - In MASTER_INFO: run_lock, data_lock + In Master_info: run_lock, data_lock run_lock protects all information about the run state: slave_running, and the existence of the I/O thread (to stop/start it, you need this mutex). data_lock protects some moving members of the struct: counters (log name, position) and relay log (MYSQL_BIN_LOG object). In Relay_log_info: run_lock, data_lock - see MASTER_INFO + see Master_info Order of acquisition: if you want to have LOCK_active_mi and a run_lock, you must acquire LOCK_active_mi first. @@ -101,7 +101,7 @@ extern my_bool opt_log_slave_updates; extern ulonglong relay_log_space_limit; /* - 3 possible values for MASTER_INFO::slave_running and + 3 possible values for Master_info::slave_running and Relay_log_info::slave_running. The values 0,1,2 are very important: to keep the diff small, I didn't substitute places where we use 0/1 with the newly defined symbols. So don't change @@ -130,14 +130,14 @@ int init_slave(); void init_slave_skip_errors(const char* arg); 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, +int terminate_slave_threads(Master_info* mi, int thread_mask, bool skip_lock = 0); int terminate_slave_thread(THD* thd, pthread_mutex_t* term_mutex, pthread_mutex_t* cond_lock, pthread_cond_t* term_cond, volatile uint* slave_running); int start_slave_threads(bool need_slave_mutex, bool wait_for_start, - MASTER_INFO* mi, const char* master_info_fname, + Master_info* mi, const char* master_info_fname, const char* slave_info_fname, int thread_mask); /* cond_lock is usually same as start_lock. It is needed for the case when @@ -150,7 +150,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock, pthread_cond_t* start_cond, volatile uint *slave_running, volatile ulong *slave_run_id, - MASTER_INFO* mi, + Master_info* mi, bool high_priority); /* If fd is -1, dump to NET */ @@ -159,9 +159,9 @@ int mysql_table_dump(THD* thd, const char* db, /* retrieve table from master and copy to slave*/ int fetch_master_table(THD* thd, const char* db_name, const char* table_name, - MASTER_INFO* mi, MYSQL* mysql, bool overwrite); + Master_info* mi, MYSQL* mysql, bool overwrite); -bool show_master_info(THD* thd, MASTER_INFO* mi); +bool show_master_info(THD* thd, Master_info* mi); bool show_binlog_info(THD* thd); bool rpl_master_has_bug(Relay_log_info *rli, uint bug_id); @@ -173,9 +173,9 @@ void end_slave(); /* clean up */ void clear_until_condition(Relay_log_info* rli); void clear_slave_error(Relay_log_info* rli); void end_relay_log_info(Relay_log_info* rli); -void lock_slave_threads(MASTER_INFO* mi); -void unlock_slave_threads(MASTER_INFO* mi); -void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse); +void lock_slave_threads(Master_info* mi); +void unlock_slave_threads(Master_info* mi); +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, bool look_for_description_event); @@ -184,12 +184,12 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset, const char** errmsg); void set_slave_thread_options(THD* thd); void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli); -void rotate_relay_log(MASTER_INFO* mi); +void rotate_relay_log(Master_info* mi); pthread_handler_t handle_slave_io(void *arg); pthread_handler_t handle_slave_sql(void *arg); extern bool volatile abort_loop; -extern MASTER_INFO main_mi, *active_mi; /* active_mi for multi-master */ +extern Master_info main_mi, *active_mi; /* active_mi for multi-master */ extern LIST master_list; extern my_bool replicate_same_server_id; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index b86153c17ce..a6e52c05219 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -762,7 +762,7 @@ err: DBUG_VOID_RETURN; } -int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) +int start_slave(THD* thd , Master_info* mi, bool net_report) { int slave_errno= 0; int thread_mask; @@ -887,7 +887,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) } -int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) +int stop_slave(THD* thd, Master_info* mi, bool net_report ) { DBUG_ENTER("stop_slave"); @@ -953,7 +953,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) */ -int reset_slave(THD *thd, MASTER_INFO* mi) +int reset_slave(THD *thd, Master_info* mi) { MY_STAT stat_area; char fname[FN_REFLEN]; @@ -1067,7 +1067,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id) } -bool change_master(THD* thd, MASTER_INFO* mi) +bool change_master(THD* thd, Master_info* mi) { int thread_mask; const char* errmsg= 0; diff --git a/sql/sql_repl.h b/sql/sql_repl.h index da50d47c60d..cf5201f17b1 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -42,20 +42,20 @@ extern my_bool opt_sporadic_binlog_dump_fail; pthread_mutex_unlock(&(thd)->LOCK_delete); \ } while(0) -int start_slave(THD* thd, MASTER_INFO* mi, bool net_report); -int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report); -bool change_master(THD* thd, MASTER_INFO* mi); +int start_slave(THD* thd, Master_info* mi, bool net_report); +int stop_slave(THD* thd, Master_info* mi, bool net_report); +bool change_master(THD* thd, Master_info* mi); bool mysql_show_binlog_events(THD* thd); int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, const char* log_file_name2, ulonglong log_pos2); -int reset_slave(THD *thd, MASTER_INFO* mi); +int reset_slave(THD *thd, Master_info* mi); int reset_master(THD* thd); bool purge_master_logs(THD* thd, const char* to_log); bool purge_master_logs_before_date(THD* thd, time_t purge_time); bool log_in_use(const char* log_name); void adjust_linfo_offsets(my_off_t purge_offset); bool show_binlogs(THD* thd); -extern int init_master_info(MASTER_INFO* mi); +extern int init_master_info(Master_info* mi); void kill_zombie_dump_threads(uint32 slave_server_id); int check_binlog_magic(IO_CACHE* log, const char** errmsg); |