Renaming MASTER_INFO to Master_info in order to follow the coding

standards (and help Doxygen generating good documentation).
parent 9c4ef25c
...@@ -4287,7 +4287,7 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd, ...@@ -4287,7 +4287,7 @@ THR_LOCK_DATA **ha_ndbcluster::store_lock(THD *thd,
*/ */
#ifdef HAVE_NDB_BINLOG #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) static int ndbcluster_update_apply_status(THD *thd, int do_update)
{ {
Thd_ndb *thd_ndb= get_thd_ndb(thd); Thd_ndb *thd_ndb= get_thd_ndb(thd);
......
...@@ -4462,7 +4462,7 @@ Slave_log_event::Slave_log_event(THD* thd_arg, ...@@ -4462,7 +4462,7 @@ Slave_log_event::Slave_log_event(THD* thd_arg,
if (!rli->inited) // QQ When can this happen ? if (!rli->inited) // QQ When can this happen ?
DBUG_VOID_RETURN; 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 // TODO: re-write this better without holding both locks at the same time
pthread_mutex_lock(&mi->data_lock); pthread_mutex_lock(&mi->data_lock);
pthread_mutex_lock(&rli->data_lock); pthread_mutex_lock(&rli->data_lock);
......
...@@ -492,7 +492,7 @@ bool show_new_master(THD* thd) ...@@ -492,7 +492,7 @@ bool show_new_master(THD* thd)
0 success 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_RES* res=0;
MYSQL_ROW row; MYSQL_ROW row;
...@@ -679,7 +679,7 @@ bool show_slave_hosts(THD* thd) ...@@ -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"); DBUG_ENTER("connect_to_master");
...@@ -728,7 +728,7 @@ static inline void cleanup_mysql_results(MYSQL_RES* db_res, ...@@ -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, 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; MYSQL_ROW row;
for (row = mysql_fetch_row(table_res); row; for (row = mysql_fetch_row(table_res); row;
......
...@@ -33,12 +33,12 @@ extern const char* rpl_role_type[], *rpl_status_type[]; ...@@ -33,12 +33,12 @@ extern const char* rpl_role_type[], *rpl_status_type[];
pthread_handler_t handle_failsafe_rpl(void *arg); pthread_handler_t handle_failsafe_rpl(void *arg);
void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status); void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status);
int find_recovery_captain(THD* thd, MYSQL* mysql); 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; extern HASH slave_list;
bool load_master_data(THD* thd); 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_new_master(THD* thd);
bool show_slave_hosts(THD* thd); bool show_slave_hosts(THD* thd);
......
...@@ -27,7 +27,7 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); ...@@ -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, int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val); const char *default_val);
MASTER_INFO::MASTER_INFO() Master_info::Master_info()
:Slave_reporting_capability("I/O"), :Slave_reporting_capability("I/O"),
ssl(0), fd(-1), io_thd(0), inited(0), ssl(0), fd(-1), io_thd(0), inited(0),
abort_slave(0),slave_running(0), abort_slave(0),slave_running(0),
...@@ -45,7 +45,7 @@ MASTER_INFO::MASTER_INFO() ...@@ -45,7 +45,7 @@ MASTER_INFO::MASTER_INFO()
pthread_cond_init(&stop_cond, NULL); pthread_cond_init(&stop_cond, NULL);
} }
MASTER_INFO::~MASTER_INFO() Master_info::~Master_info()
{ {
pthread_mutex_destroy(&run_lock); pthread_mutex_destroy(&run_lock);
pthread_mutex_destroy(&data_lock); pthread_mutex_destroy(&data_lock);
...@@ -55,7 +55,7 @@ MASTER_INFO::~MASTER_INFO() ...@@ -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"); DBUG_ENTER("init_master_info_with_options");
...@@ -98,7 +98,7 @@ enum { ...@@ -98,7 +98,7 @@ enum {
LINES_IN_MASTER_INFO= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT 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, const char* slave_info_fname,
bool abort_if_no_master_info_file, bool abort_if_no_master_info_file,
int thread_mask) int thread_mask)
...@@ -338,7 +338,7 @@ file '%s')", fname); ...@@ -338,7 +338,7 @@ file '%s')", fname);
1 - flush master info failed 1 - flush master info failed
0 - all ok 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; IO_CACHE* file = &mi->file;
char lbuf[22]; char lbuf[22];
...@@ -392,7 +392,7 @@ int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache) ...@@ -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"); DBUG_ENTER("end_master_info");
......
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
Replication IO Thread Replication IO Thread
MASTER_INFO contains: Master_info contains:
- information about how to connect to a master - information about how to connect to a master
- current master log name - current master log name
- current master log offset - current master log offset
- misc control variables - 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 exists. Otherwise, data members corresponding to master.info fields
are initialized with defaults specified by master-* options. The are initialized with defaults specified by master-* options. The
initialization is done through init_master_info() call. initialization is done through init_master_info() call.
...@@ -55,11 +55,11 @@ ...@@ -55,11 +55,11 @@
*****************************************************************************/ *****************************************************************************/
class MASTER_INFO : public Slave_reporting_capability class Master_info : public Slave_reporting_capability
{ {
public: public:
MASTER_INFO(); Master_info();
~MASTER_INFO(); ~Master_info();
/* the variables below are needed because we can change masters on the fly */ /* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN]; char master_log_name[FN_REFLEN];
...@@ -102,13 +102,13 @@ class MASTER_INFO : public Slave_reporting_capability ...@@ -102,13 +102,13 @@ class MASTER_INFO : public Slave_reporting_capability
long clock_diff_with_master; long clock_diff_with_master;
}; };
void init_master_info_with_options(MASTER_INFO* mi); void init_master_info_with_options(Master_info* mi);
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, const char* slave_info_fname,
bool abort_if_no_master_info_file, bool abort_if_no_master_info_file,
int thread_mask); int thread_mask);
void end_master_info(MASTER_INFO* mi); void end_master_info(Master_info* mi);
int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache); int flush_master_info(Master_info* mi, bool flush_relay_log_cache);
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
#endif /* RPL_MI_H */ #endif /* RPL_MI_H */
...@@ -121,8 +121,8 @@ class Relay_log_info : public Slave_reporting_capability ...@@ -121,8 +121,8 @@ class Relay_log_info : public Slave_reporting_capability
*/ */
pthread_cond_t start_cond, stop_cond, data_cond; pthread_cond_t start_cond, stop_cond, data_cond;
/* parent MASTER_INFO structure */ /* parent Master_info structure */
class MASTER_INFO *mi; class Master_info *mi;
/* /*
Needed to deal properly with cur_log getting closed and re-opened with Needed to deal properly with cur_log getting closed and re-opened with
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "rpl_tblmap.h" #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); static Log_event* next_event(Relay_log_info* rli);
...@@ -46,7 +46,7 @@ MY_BITMAP slave_error_mask; ...@@ -46,7 +46,7 @@ MY_BITMAP slave_error_mask;
typedef bool (*CHECK_KILLED_FUNC)(THD*,void*); typedef bool (*CHECK_KILLED_FUNC)(THD*,void*);
char* slave_load_tmpdir = 0; char* slave_load_tmpdir = 0;
MASTER_INFO *active_mi= 0; Master_info *active_mi= 0;
my_bool replicate_same_server_id; my_bool replicate_same_server_id;
ulonglong relay_log_space_limit = 0; ulonglong relay_log_space_limit = 0;
...@@ -54,7 +54,7 @@ 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 When slave thread exits, we need to remember the temporary tables so we
can re-use them on slave start. 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; int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
...@@ -114,23 +114,23 @@ failed read" ...@@ -114,23 +114,23 @@ failed read"
typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE; 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_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_create_file(Master_info* mi, Create_file_log_event* cev);
static bool wait_for_relay_log_space(Relay_log_info* rli); 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 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 init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type);
static int safe_connect(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, static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi,
bool suppress_warnings); 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); bool reconnect, bool suppress_warnings);
static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
void* thread_killed_arg); void* thread_killed_arg);
static int request_table_dump(MYSQL* mysql, const char* db, const char* table); 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, static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
const char* table_name, bool overwrite); 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); static Log_event* next_event(Relay_log_info* rli);
/* /*
...@@ -151,7 +151,7 @@ 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 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; bool set_io = mi->slave_running, set_sql = mi->rli.slave_running;
register int tmp_mask=0; register int tmp_mask=0;
...@@ -172,7 +172,7 @@ void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse) ...@@ -172,7 +172,7 @@ void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse)
lock_slave_threads() lock_slave_threads()
*/ */
void lock_slave_threads(MASTER_INFO* mi) void lock_slave_threads(Master_info* mi)
{ {
DBUG_ENTER("lock_slave_threads"); DBUG_ENTER("lock_slave_threads");
...@@ -187,7 +187,7 @@ void lock_slave_threads(MASTER_INFO* mi) ...@@ -187,7 +187,7 @@ void lock_slave_threads(MASTER_INFO* mi)
unlock_slave_threads() unlock_slave_threads()
*/ */
void unlock_slave_threads(MASTER_INFO* mi) void unlock_slave_threads(Master_info* mi)
{ {
DBUG_ENTER("unlock_slave_threads"); DBUG_ENTER("unlock_slave_threads");
...@@ -214,7 +214,7 @@ int init_slave() ...@@ -214,7 +214,7 @@ int init_slave()
TODO: re-write this to interate through the list of files TODO: re-write this to interate through the list of files
for multi-master 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. 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) ...@@ -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"); DBUG_ENTER("terminate_slave_threads");
...@@ -393,7 +393,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, ...@@ -393,7 +393,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock,
pthread_cond_t *start_cond, pthread_cond_t *start_cond,
volatile uint *slave_running, volatile uint *slave_running,
volatile ulong *slave_run_id, volatile ulong *slave_run_id,
MASTER_INFO* mi, Master_info* mi,
bool high_priority) bool high_priority)
{ {
pthread_t th; pthread_t th;
...@@ -463,7 +463,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, ...@@ -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, 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) 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; 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, ...@@ -503,7 +503,7 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
#ifdef NOT_USED_YET #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"); DBUG_ENTER("end_slave_on_walk");
...@@ -549,7 +549,7 @@ void end_slave() ...@@ -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"); DBUG_ENTER("io_slave_killed");
...@@ -699,7 +699,7 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) ...@@ -699,7 +699,7 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val)
1 error 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; const char* errmsg= 0;
DBUG_ENTER("get_master_version_and_clock"); DBUG_ENTER("get_master_version_and_clock");
...@@ -1018,7 +1018,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, ...@@ -1018,7 +1018,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
int fetch_master_table(THD *thd, const char *db_name, const char *table_name, 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; int error= 1;
const char *errmsg=0; const char *errmsg=0;
...@@ -1076,7 +1076,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, ...@@ -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) static bool wait_for_relay_log_space(Relay_log_info* rli)
{ {
bool slave_killed=0; bool slave_killed=0;
MASTER_INFO* mi = rli->mi; Master_info* mi = rli->mi;
const char *save_proc_info; const char *save_proc_info;
THD* thd = mi->io_thd; THD* thd = mi->io_thd;
DBUG_ENTER("wait_for_relay_log_space"); DBUG_ENTER("wait_for_relay_log_space");
...@@ -1108,7 +1108,7 @@ Waiting for the slave SQL thread to free enough 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 ignored events' end position for the use of the slave SQL thread, by
calling this function. Only that thread can call it (see assertion). 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; Relay_log_info *rli= &mi->rli;
pthread_mutex_t *log_lock= rli->relay_log.get_log_lock(); 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) ...@@ -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) bool *suppress_warnings)
{ {
uchar buf[1024], *pos= buf; uchar buf[1024], *pos= buf;
...@@ -1200,7 +1200,7 @@ int register_slave_on_master(MYSQL* mysql, MASTER_INFO *mi, ...@@ -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 // TODO: fix this for multi-master
List<Item> field_list; List<Item> field_list;
...@@ -1514,7 +1514,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, ...@@ -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) bool *suppress_warnings)
{ {
uchar buf[FN_REFLEN + 10]; uchar buf[FN_REFLEN + 10];
...@@ -1598,7 +1598,7 @@ command"); ...@@ -1598,7 +1598,7 @@ command");
number Length of packet 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; ulong len;
DBUG_ENTER("read_event"); DBUG_ENTER("read_event");
...@@ -1943,7 +1943,7 @@ on this slave.\ ...@@ -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)) if (io_slave_killed(thd, mi))
{ {
...@@ -1981,7 +1981,7 @@ static bool check_io_slave_killed(THD *thd, MASTER_INFO *mi, const char *info) ...@@ -1981,7 +1981,7 @@ static bool check_io_slave_killed(THD *thd, MASTER_INFO *mi, const char *info)
@retval 1 There was an error. @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, uint *retry_count, bool suppress_warnings,
const char *messages[SLAVE_RECON_MSG_MAX]) const char *messages[SLAVE_RECON_MSG_MAX])
{ {
...@@ -2037,7 +2037,7 @@ pthread_handler_t handle_slave_io(void *arg) ...@@ -2037,7 +2037,7 @@ pthread_handler_t handle_slave_io(void *arg)
{ {
THD *thd; // needs to be first for thread_stack THD *thd; // needs to be first for thread_stack
MYSQL *mysql; MYSQL *mysql;
MASTER_INFO *mi = (MASTER_INFO*)arg; Master_info *mi = (Master_info*)arg;
Relay_log_info *rli= &mi->rli; Relay_log_info *rli= &mi->rli;
char llbuff[22]; char llbuff[22];
uint retry_count; uint retry_count;
...@@ -2311,7 +2311,7 @@ log space"); ...@@ -2311,7 +2311,7 @@ log space");
/* Forget the relay log's format */ /* Forget the relay log's format */
delete mi->rli.relay_log.description_event_for_queue; delete mi->rli.relay_log.description_event_for_queue;
mi->rli.relay_log.description_event_for_queue= 0; 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); change_rpl_status(RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE);
DBUG_ASSERT(thd->net.buff != 0); DBUG_ASSERT(thd->net.buff != 0);
net_end(&thd->net); // destructor will not free it, because net.vio is 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) ...@@ -2343,7 +2343,7 @@ pthread_handler_t handle_slave_sql(void *arg)
THD *thd; /* needs to be first for thread_stack */ THD *thd; /* needs to be first for thread_stack */
char llbuff[22],llbuff1[22]; char llbuff[22],llbuff1[22];
Relay_log_info* rli = &((MASTER_INFO*)arg)->rli; Relay_log_info* rli = &((Master_info*)arg)->rli;
const char *errmsg; const char *errmsg;
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff // 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 \ ...@@ -2612,7 +2612,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
process_io_create_file() 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; int error = 1;
ulong num_bytes; ulong num_bytes;
...@@ -2739,7 +2739,7 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) ...@@ -2739,7 +2739,7 @@ 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_rotate(Master_info *mi, Rotate_log_event *rev)
{ {
DBUG_ENTER("process_io_rotate"); DBUG_ENTER("process_io_rotate");
safe_mutex_assert_owner(&mi->data_lock); safe_mutex_assert_owner(&mi->data_lock);
...@@ -2787,7 +2787,7 @@ static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) ...@@ -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 Reads a 3.23 event and converts it to the slave's format. This code was
copied from MySQL 4.0. 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) ulong event_len)
{ {
const char *errmsg = 0; const char *errmsg = 0;
...@@ -2905,7 +2905,7 @@ static int queue_binlog_ver_1_event(MASTER_INFO *mi, const char *buf, ...@@ -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 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. 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) ulong event_len)
{ {
const char *errmsg = 0; const char *errmsg = 0;
...@@ -2969,7 +2969,7 @@ static int queue_binlog_ver_3_event(MASTER_INFO *mi, const char *buf, ...@@ -2969,7 +2969,7 @@ static int queue_binlog_ver_3_event(MASTER_INFO *mi, const char *buf,
setup with 3.23 master or 4.0 master 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) ulong event_len)
{ {
DBUG_ENTER("queue_old_event"); DBUG_ENTER("queue_old_event");
...@@ -2997,7 +2997,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, ...@@ -2997,7 +2997,7 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf,
any >=5.0.0 format. 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; int error= 0;
ulong inc_pos; ulong inc_pos;
...@@ -3197,7 +3197,7 @@ void end_relay_log_info(Relay_log_info* rli) ...@@ -3197,7 +3197,7 @@ void end_relay_log_info(Relay_log_info* rli)
# Error # 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"); DBUG_ENTER("safe_connect");
...@@ -3214,7 +3214,7 @@ static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi) ...@@ -3214,7 +3214,7 @@ static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi)
master_retry_count times 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) bool reconnect, bool suppress_warnings)
{ {
int slave_was_killed; int slave_was_killed;
...@@ -3320,7 +3320,7 @@ replication resumed in log '%s' at position %s", mi->user, ...@@ -3320,7 +3320,7 @@ replication resumed in log '%s' at position %s", mi->user,
master_retry_count times 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) bool suppress_warnings)
{ {
DBUG_ENTER("safe_reconnect"); DBUG_ENTER("safe_reconnect");
...@@ -3764,7 +3764,7 @@ event(errno: %d cur_log->error: %d)", ...@@ -3764,7 +3764,7 @@ event(errno: %d cur_log->error: %d)",
is void). is void).
*/ */
void rotate_relay_log(MASTER_INFO* mi) void rotate_relay_log(Master_info* mi)
{ {
DBUG_ENTER("rotate_relay_log"); DBUG_ENTER("rotate_relay_log");
Relay_log_info* rli= &mi->rli; Relay_log_info* rli= &mi->rli;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
// Forward declarations // Forward declarations
class Relay_log_info; class Relay_log_info;
class MASTER_INFO; class Master_info;
/***************************************************************************** /*****************************************************************************
...@@ -42,7 +42,7 @@ class MASTER_INFO; ...@@ -42,7 +42,7 @@ class MASTER_INFO;
I/O Thread - One of these threads is started for each master server. I/O Thread - One of these threads is started for each master server.
They maintain a connection to their master server, read log They maintain a connection to their master server, read log
events from the master as they arrive, and queues them into 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. represents each of these threads.
SQL Thread - One of these threads is started and reads from the relay log SQL Thread - One of these threads is started and reads from the relay log
...@@ -69,18 +69,18 @@ class MASTER_INFO; ...@@ -69,18 +69,18 @@ class MASTER_INFO;
mi->run_lock, keeps rli->run_lock, and tries to re-acquire mi->run_lock). 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 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 because we don't have multimaster. So for the moment, mi does not move, and
mi->rli does not either. 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 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). 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, data_lock protects some moving members of the struct: counters (log name,
position) and relay log (MYSQL_BIN_LOG object). position) and relay log (MYSQL_BIN_LOG object).
In Relay_log_info: run_lock, data_lock 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 Order of acquisition: if you want to have LOCK_active_mi and a run_lock, you
must acquire LOCK_active_mi first. must acquire LOCK_active_mi first.
...@@ -101,7 +101,7 @@ extern my_bool opt_log_slave_updates; ...@@ -101,7 +101,7 @@ extern my_bool opt_log_slave_updates;
extern ulonglong relay_log_space_limit; 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. Relay_log_info::slave_running.
The values 0,1,2 are very important: to keep the diff small, I didn't 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 substitute places where we use 0/1 with the newly defined symbols. So don't change
...@@ -130,14 +130,14 @@ int init_slave(); ...@@ -130,14 +130,14 @@ int init_slave();
void init_slave_skip_errors(const char* arg); void init_slave_skip_errors(const char* arg);
bool flush_relay_log_info(Relay_log_info* rli); bool flush_relay_log_info(Relay_log_info* rli);
int register_slave_on_master(MYSQL* mysql); 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); bool skip_lock = 0);
int terminate_slave_thread(THD* thd, pthread_mutex_t* term_mutex, int terminate_slave_thread(THD* thd, pthread_mutex_t* term_mutex,
pthread_mutex_t* cond_lock, pthread_mutex_t* cond_lock,
pthread_cond_t* term_cond, pthread_cond_t* term_cond,
volatile uint* slave_running); volatile uint* slave_running);
int start_slave_threads(bool need_slave_mutex, bool wait_for_start, 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); const char* slave_info_fname, int thread_mask);
/* /*
cond_lock is usually same as start_lock. It is needed for the case when 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, ...@@ -150,7 +150,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock,
pthread_cond_t* start_cond, pthread_cond_t* start_cond,
volatile uint *slave_running, volatile uint *slave_running,
volatile ulong *slave_run_id, volatile ulong *slave_run_id,
MASTER_INFO* mi, Master_info* mi,
bool high_priority); bool high_priority);
/* If fd is -1, dump to NET */ /* If fd is -1, dump to NET */
...@@ -159,9 +159,9 @@ int mysql_table_dump(THD* thd, const char* db, ...@@ -159,9 +159,9 @@ int mysql_table_dump(THD* thd, const char* db,
/* retrieve table from master and copy to slave*/ /* retrieve table from master and copy to slave*/
int fetch_master_table(THD* thd, const char* db_name, const char* table_name, 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 show_binlog_info(THD* thd);
bool rpl_master_has_bug(Relay_log_info *rli, uint bug_id); bool rpl_master_has_bug(Relay_log_info *rli, uint bug_id);
...@@ -173,9 +173,9 @@ void end_slave(); /* clean up */ ...@@ -173,9 +173,9 @@ void end_slave(); /* clean up */
void clear_until_condition(Relay_log_info* rli); void clear_until_condition(Relay_log_info* rli);
void clear_slave_error(Relay_log_info* rli); void clear_slave_error(Relay_log_info* rli);
void end_relay_log_info(Relay_log_info* rli); void end_relay_log_info(Relay_log_info* rli);
void lock_slave_threads(MASTER_INFO* mi); void lock_slave_threads(Master_info* mi);
void unlock_slave_threads(MASTER_INFO* mi); void unlock_slave_threads(Master_info* mi);
void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse); 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, int init_relay_log_pos(Relay_log_info* rli,const char* log,ulonglong pos,
bool need_data_lock, const char** errmsg, bool need_data_lock, const char** errmsg,
bool look_for_description_event); bool look_for_description_event);
...@@ -184,12 +184,12 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset, ...@@ -184,12 +184,12 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
const char** errmsg); const char** errmsg);
void set_slave_thread_options(THD* thd); void set_slave_thread_options(THD* thd);
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli); 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_io(void *arg);
pthread_handler_t handle_slave_sql(void *arg); pthread_handler_t handle_slave_sql(void *arg);
extern bool volatile abort_loop; 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 LIST master_list;
extern my_bool replicate_same_server_id; extern my_bool replicate_same_server_id;
......
...@@ -762,7 +762,7 @@ impossible position"; ...@@ -762,7 +762,7 @@ impossible position";
DBUG_VOID_RETURN; 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 slave_errno= 0;
int thread_mask; int thread_mask;
...@@ -887,7 +887,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -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"); DBUG_ENTER("stop_slave");
...@@ -953,7 +953,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) ...@@ -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; MY_STAT stat_area;
char fname[FN_REFLEN]; char fname[FN_REFLEN];
...@@ -1067,7 +1067,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id) ...@@ -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; int thread_mask;
const char* errmsg= 0; const char* errmsg= 0;
......
...@@ -42,20 +42,20 @@ extern my_bool opt_sporadic_binlog_dump_fail; ...@@ -42,20 +42,20 @@ extern my_bool opt_sporadic_binlog_dump_fail;
pthread_mutex_unlock(&(thd)->LOCK_delete); \ pthread_mutex_unlock(&(thd)->LOCK_delete); \
} while(0) } while(0)
int start_slave(THD* thd, MASTER_INFO* mi, bool net_report); 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);
bool change_master(THD* thd, MASTER_INFO* mi); bool change_master(THD* thd, Master_info* mi);
bool mysql_show_binlog_events(THD* thd); bool mysql_show_binlog_events(THD* thd);
int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
const char* log_file_name2, ulonglong log_pos2); 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); int reset_master(THD* thd);
bool purge_master_logs(THD* thd, const char* to_log); bool purge_master_logs(THD* thd, const char* to_log);
bool purge_master_logs_before_date(THD* thd, time_t purge_time); bool purge_master_logs_before_date(THD* thd, time_t purge_time);
bool log_in_use(const char* log_name); bool log_in_use(const char* log_name);
void adjust_linfo_offsets(my_off_t purge_offset); void adjust_linfo_offsets(my_off_t purge_offset);
bool show_binlogs(THD* thd); 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); void kill_zombie_dump_threads(uint32 slave_server_id);
int check_binlog_magic(IO_CACHE* log, const char** errmsg); int check_binlog_magic(IO_CACHE* log, const char** errmsg);
......
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