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 @@ err: ...@@ -338,7 +338,7 @@ err:
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 @@ public: ...@@ -121,8 +121,8 @@ public:
*/ */
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
......
This diff is collapsed.
...@@ -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 @@ err: ...@@ -762,7 +762,7 @@ err:
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