Commit 112c64a0 authored by mats@kindahl-laptop.dnsalias.net's avatar mats@kindahl-laptop.dnsalias.net

Merge kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl

into  kindahl-laptop.dnsalias.net:/home/bk/fix-mysql-5.1-rpl
parents 4ecac78f 1b85aab2
...@@ -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);
......
...@@ -2734,7 +2734,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) ...@@ -2734,7 +2734,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
int MYSQL_BIN_LOG::purge_first_log(struct st_relay_log_info* rli, bool included) int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
{ {
int error; int error;
DBUG_ENTER("purge_first_log"); DBUG_ENTER("purge_first_log");
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#ifndef LOG_H #ifndef LOG_H
#define LOG_H #define LOG_H
struct st_relay_log_info; class Relay_log_info;
class Format_description_log_event; class Format_description_log_event;
...@@ -121,7 +121,7 @@ extern TC_LOG_DUMMY tc_log_dummy; ...@@ -121,7 +121,7 @@ extern TC_LOG_DUMMY tc_log_dummy;
#define LOG_CLOSE_TO_BE_OPENED 2 #define LOG_CLOSE_TO_BE_OPENED 2
#define LOG_CLOSE_STOP_EVENT 4 #define LOG_CLOSE_STOP_EVENT 4
struct st_relay_log_info; class Relay_log_info;
typedef struct st_log_info typedef struct st_log_info
{ {
...@@ -362,7 +362,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG ...@@ -362,7 +362,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
bool need_mutex, bool need_update_threads, bool need_mutex, bool need_update_threads,
ulonglong *decrease_log_space); ulonglong *decrease_log_space);
int purge_logs_before_date(time_t purge_time); int purge_logs_before_date(time_t purge_time);
int purge_first_log(struct st_relay_log_info* rli, bool included); int purge_first_log(Relay_log_info* rli, bool included);
bool reset_logs(THD* thd); bool reset_logs(THD* thd);
void close(uint exiting); void close(uint exiting);
......
...@@ -146,7 +146,7 @@ static void pretty_print_str(IO_CACHE* cache, char* str, int len) ...@@ -146,7 +146,7 @@ static void pretty_print_str(IO_CACHE* cache, char* str, int len)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
static void clear_all_errors(THD *thd, RELAY_LOG_INFO *rli) static void clear_all_errors(THD *thd, Relay_log_info *rli)
{ {
thd->query_error = 0; thd->query_error = 0;
thd->clear_error(); thd->clear_error();
...@@ -536,7 +536,7 @@ Log_event::Log_event(const char* buf, ...@@ -536,7 +536,7 @@ Log_event::Log_event(const char* buf,
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
int Log_event::do_update_pos(RELAY_LOG_INFO *rli) int Log_event::do_update_pos(Relay_log_info *rli)
{ {
/* /*
rli is null when (as far as I (Guilhem) know) the caller is rli is null when (as far as I (Guilhem) know) the caller is
...@@ -558,7 +558,7 @@ int Log_event::do_update_pos(RELAY_LOG_INFO *rli) ...@@ -558,7 +558,7 @@ int Log_event::do_update_pos(RELAY_LOG_INFO *rli)
Log_event::enum_skip_reason Log_event::enum_skip_reason
Log_event::do_shall_skip(RELAY_LOG_INFO *rli) Log_event::do_shall_skip(Relay_log_info *rli)
{ {
DBUG_PRINT("info", ("ev->server_id=%lu, ::server_id=%lu," DBUG_PRINT("info", ("ev->server_id=%lu, ::server_id=%lu,"
" rli->replicate_same_server_id=%d," " rli->replicate_same_server_id=%d,"
...@@ -1920,13 +1920,13 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -1920,13 +1920,13 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Query_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Query_log_event::do_apply_event(Relay_log_info const *rli)
{ {
return do_apply_event(rli, query, q_len); return do_apply_event(rli, query, q_len);
} }
int Query_log_event::do_apply_event(RELAY_LOG_INFO const *rli, int Query_log_event::do_apply_event(Relay_log_info const *rli,
const char *query_arg, uint32 q_len_arg) const char *query_arg, uint32 q_len_arg)
{ {
LEX_STRING new_db; LEX_STRING new_db;
...@@ -1955,11 +1955,11 @@ int Query_log_event::do_apply_event(RELAY_LOG_INFO const *rli, ...@@ -1955,11 +1955,11 @@ int Query_log_event::do_apply_event(RELAY_LOG_INFO const *rli,
END of the current log event (COMMIT). We save it in rli so that InnoDB can END of the current log event (COMMIT). We save it in rli so that InnoDB can
access it. access it.
*/ */
const_cast<RELAY_LOG_INFO*>(rli)->future_group_master_log_pos= log_pos; const_cast<Relay_log_info*>(rli)->future_group_master_log_pos= log_pos;
DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos)); DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
clear_all_errors(thd, const_cast<RELAY_LOG_INFO*>(rli)); clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
const_cast<RELAY_LOG_INFO*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
/* /*
Note: We do not need to execute reset_one_shot_variables() if this Note: We do not need to execute reset_one_shot_variables() if this
...@@ -2085,7 +2085,7 @@ int Query_log_event::do_apply_event(RELAY_LOG_INFO const *rli, ...@@ -2085,7 +2085,7 @@ int Query_log_event::do_apply_event(RELAY_LOG_INFO const *rli,
to check/fix it. to check/fix it.
*/ */
if (mysql_test_parse_for_slave(thd, thd->query, thd->query_length)) if (mysql_test_parse_for_slave(thd, thd->query, thd->query_length))
clear_all_errors(thd, const_cast<RELAY_LOG_INFO*>(rli)); /* Can ignore query */ clear_all_errors(thd, const_cast<Relay_log_info*>(rli)); /* Can ignore query */
else else
{ {
rli->report(ERROR_LEVEL, expected_error, rli->report(ERROR_LEVEL, expected_error,
...@@ -2136,7 +2136,7 @@ Default database: '%s'. Query: '%s'", ...@@ -2136,7 +2136,7 @@ Default database: '%s'. Query: '%s'",
ignored_error_code(actual_error)) ignored_error_code(actual_error))
{ {
DBUG_PRINT("info",("error ignored")); DBUG_PRINT("info",("error ignored"));
clear_all_errors(thd, const_cast<RELAY_LOG_INFO*>(rli)); clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
thd->killed= THD::NOT_KILLED; thd->killed= THD::NOT_KILLED;
} }
/* /*
...@@ -2207,7 +2207,7 @@ Default database: '%s'. Query: '%s'", ...@@ -2207,7 +2207,7 @@ Default database: '%s'. Query: '%s'",
return thd->query_error; return thd->query_error;
} }
int Query_log_event::do_update_pos(RELAY_LOG_INFO *rli) int Query_log_event::do_update_pos(Relay_log_info *rli)
{ {
/* /*
Note that we will not increment group* positions if we are just Note that we will not increment group* positions if we are just
...@@ -2371,7 +2371,7 @@ bool Start_log_event_v3::write(IO_CACHE* file) ...@@ -2371,7 +2371,7 @@ bool Start_log_event_v3::write(IO_CACHE* file)
*/ */
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Start_log_event_v3::do_apply_event(RELAY_LOG_INFO const *rli) int Start_log_event_v3::do_apply_event(Relay_log_info const *rli)
{ {
DBUG_ENTER("Start_log_event_v3::do_apply_event"); DBUG_ENTER("Start_log_event_v3::do_apply_event");
switch (binlog_version) switch (binlog_version)
...@@ -2608,7 +2608,7 @@ bool Format_description_log_event::write(IO_CACHE* file) ...@@ -2608,7 +2608,7 @@ bool Format_description_log_event::write(IO_CACHE* file)
#endif #endif
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Format_description_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
{ {
DBUG_ENTER("Format_description_log_event::do_apply_event"); DBUG_ENTER("Format_description_log_event::do_apply_event");
...@@ -2632,7 +2632,7 @@ int Format_description_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -2632,7 +2632,7 @@ int Format_description_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
"or ROLLBACK in relay log). A probable cause is that " "or ROLLBACK in relay log). A probable cause is that "
"the master died while writing the transaction to " "the master died while writing the transaction to "
"its binary log, thus rolled back too."); "its binary log, thus rolled back too.");
const_cast<RELAY_LOG_INFO*>(rli)->cleanup_context(thd, 1); const_cast<Relay_log_info*>(rli)->cleanup_context(thd, 1);
} }
#endif #endif
/* /*
...@@ -2656,7 +2656,7 @@ int Format_description_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -2656,7 +2656,7 @@ int Format_description_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
int Format_description_log_event::do_update_pos(RELAY_LOG_INFO *rli) int Format_description_log_event::do_update_pos(Relay_log_info *rli)
{ {
/* save the information describing this binlog */ /* save the information describing this binlog */
delete rli->relay_log.description_event_for_exec; delete rli->relay_log.description_event_for_exec;
...@@ -2687,7 +2687,7 @@ int Format_description_log_event::do_update_pos(RELAY_LOG_INFO *rli) ...@@ -2687,7 +2687,7 @@ int Format_description_log_event::do_update_pos(RELAY_LOG_INFO *rli)
} }
Log_event::enum_skip_reason Log_event::enum_skip_reason
Format_description_log_event::do_shall_skip(RELAY_LOG_INFO *rli) Format_description_log_event::do_shall_skip(Relay_log_info *rli)
{ {
return Log_event::EVENT_SKIP_NOT; return Log_event::EVENT_SKIP_NOT;
} }
...@@ -3230,7 +3230,7 @@ void Load_log_event::set_fields(const char* affected_db, ...@@ -3230,7 +3230,7 @@ void Load_log_event::set_fields(const char* affected_db,
1 Failure 1 Failure
*/ */
int Load_log_event::do_apply_event(NET* net, RELAY_LOG_INFO const *rli, int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
bool use_rli_only_for_errors) bool use_rli_only_for_errors)
{ {
LEX_STRING new_db; LEX_STRING new_db;
...@@ -3240,7 +3240,7 @@ int Load_log_event::do_apply_event(NET* net, RELAY_LOG_INFO const *rli, ...@@ -3240,7 +3240,7 @@ int Load_log_event::do_apply_event(NET* net, RELAY_LOG_INFO const *rli,
DBUG_ASSERT(thd->query == 0); DBUG_ASSERT(thd->query == 0);
thd->query_length= 0; // Should not be needed thd->query_length= 0; // Should not be needed
thd->query_error= 0; thd->query_error= 0;
clear_all_errors(thd, const_cast<RELAY_LOG_INFO*>(rli)); clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
/* see Query_log_event::do_apply_event() and BUG#13360 */ /* see Query_log_event::do_apply_event() and BUG#13360 */
DBUG_ASSERT(!rli->m_table_map.count()); DBUG_ASSERT(!rli->m_table_map.count());
...@@ -3257,7 +3257,7 @@ int Load_log_event::do_apply_event(NET* net, RELAY_LOG_INFO const *rli, ...@@ -3257,7 +3257,7 @@ int Load_log_event::do_apply_event(NET* net, RELAY_LOG_INFO const *rli,
Saved for InnoDB, see comment in Saved for InnoDB, see comment in
Query_log_event::do_apply_event() Query_log_event::do_apply_event()
*/ */
const_cast<RELAY_LOG_INFO*>(rli)->future_group_master_log_pos= log_pos; const_cast<Relay_log_info*>(rli)->future_group_master_log_pos= log_pos;
DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos)); DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
} }
...@@ -3621,7 +3621,7 @@ bool Rotate_log_event::write(IO_CACHE* file) ...@@ -3621,7 +3621,7 @@ bool Rotate_log_event::write(IO_CACHE* file)
*/ */
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Rotate_log_event::do_update_pos(RELAY_LOG_INFO *rli) int Rotate_log_event::do_update_pos(Relay_log_info *rli)
{ {
DBUG_ENTER("Rotate_log_event::do_update_pos"); DBUG_ENTER("Rotate_log_event::do_update_pos");
#ifndef DBUG_OFF #ifndef DBUG_OFF
...@@ -3691,7 +3691,7 @@ int Rotate_log_event::do_update_pos(RELAY_LOG_INFO *rli) ...@@ -3691,7 +3691,7 @@ int Rotate_log_event::do_update_pos(RELAY_LOG_INFO *rli)
Log_event::enum_skip_reason Log_event::enum_skip_reason
Rotate_log_event::do_shall_skip(RELAY_LOG_INFO *rli) Rotate_log_event::do_shall_skip(Relay_log_info *rli)
{ {
enum_skip_reason reason= Log_event::do_shall_skip(rli); enum_skip_reason reason= Log_event::do_shall_skip(rli);
...@@ -3817,13 +3817,13 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -3817,13 +3817,13 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
*/ */
#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
int Intvar_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
{ {
/* /*
We are now in a statement until the associated query log event has We are now in a statement until the associated query log event has
been processed. been processed.
*/ */
const_cast<RELAY_LOG_INFO*>(rli)->set_flag(RELAY_LOG_INFO::IN_STMT); const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
switch (type) { switch (type) {
case LAST_INSERT_ID_EVENT: case LAST_INSERT_ID_EVENT:
...@@ -3837,7 +3837,7 @@ int Intvar_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -3837,7 +3837,7 @@ int Intvar_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
return 0; return 0;
} }
int Intvar_log_event::do_update_pos(RELAY_LOG_INFO *rli) int Intvar_log_event::do_update_pos(Relay_log_info *rli)
{ {
rli->inc_event_relay_log_pos(); rli->inc_event_relay_log_pos();
return 0; return 0;
...@@ -3845,7 +3845,7 @@ int Intvar_log_event::do_update_pos(RELAY_LOG_INFO *rli) ...@@ -3845,7 +3845,7 @@ int Intvar_log_event::do_update_pos(RELAY_LOG_INFO *rli)
Log_event::enum_skip_reason Log_event::enum_skip_reason
Intvar_log_event::do_shall_skip(RELAY_LOG_INFO *rli) Intvar_log_event::do_shall_skip(Relay_log_info *rli)
{ {
/* /*
It is a common error to set the slave skip counter to 1 instead of It is a common error to set the slave skip counter to 1 instead of
...@@ -3923,20 +3923,20 @@ void Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -3923,20 +3923,20 @@ void Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Rand_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Rand_log_event::do_apply_event(Relay_log_info const *rli)
{ {
/* /*
We are now in a statement until the associated query log event has We are now in a statement until the associated query log event has
been processed. been processed.
*/ */
const_cast<RELAY_LOG_INFO*>(rli)->set_flag(RELAY_LOG_INFO::IN_STMT); const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
thd->rand.seed1= (ulong) seed1; thd->rand.seed1= (ulong) seed1;
thd->rand.seed2= (ulong) seed2; thd->rand.seed2= (ulong) seed2;
return 0; return 0;
} }
int Rand_log_event::do_update_pos(RELAY_LOG_INFO *rli) int Rand_log_event::do_update_pos(Relay_log_info *rli)
{ {
rli->inc_event_relay_log_pos(); rli->inc_event_relay_log_pos();
return 0; return 0;
...@@ -3944,7 +3944,7 @@ int Rand_log_event::do_update_pos(RELAY_LOG_INFO *rli) ...@@ -3944,7 +3944,7 @@ int Rand_log_event::do_update_pos(RELAY_LOG_INFO *rli)
Log_event::enum_skip_reason Log_event::enum_skip_reason
Rand_log_event::do_shall_skip(RELAY_LOG_INFO *rli) Rand_log_event::do_shall_skip(Relay_log_info *rli)
{ {
/* /*
It is a common error to set the slave skip counter to 1 instead of It is a common error to set the slave skip counter to 1 instead of
...@@ -4026,7 +4026,7 @@ void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -4026,7 +4026,7 @@ void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Xid_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Xid_log_event::do_apply_event(Relay_log_info const *rli)
{ {
/* For a slave Xid_log_event is COMMIT */ /* For a slave Xid_log_event is COMMIT */
general_log_print(thd, COM_QUERY, general_log_print(thd, COM_QUERY,
...@@ -4323,7 +4323,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -4323,7 +4323,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
*/ */
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int User_var_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int User_var_log_event::do_apply_event(Relay_log_info const *rli)
{ {
Item *it= 0; Item *it= 0;
CHARSET_INFO *charset; CHARSET_INFO *charset;
...@@ -4339,7 +4339,7 @@ int User_var_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -4339,7 +4339,7 @@ int User_var_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
We are now in a statement until the associated query log event has We are now in a statement until the associated query log event has
been processed. been processed.
*/ */
const_cast<RELAY_LOG_INFO*>(rli)->set_flag(RELAY_LOG_INFO::IN_STMT); const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
if (is_null) if (is_null)
{ {
...@@ -4394,14 +4394,14 @@ int User_var_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -4394,14 +4394,14 @@ int User_var_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
return 0; return 0;
} }
int User_var_log_event::do_update_pos(RELAY_LOG_INFO *rli) int User_var_log_event::do_update_pos(Relay_log_info *rli)
{ {
rli->inc_event_relay_log_pos(); rli->inc_event_relay_log_pos();
return 0; return 0;
} }
Log_event::enum_skip_reason Log_event::enum_skip_reason
User_var_log_event::do_shall_skip(RELAY_LOG_INFO *rli) User_var_log_event::do_shall_skip(Relay_log_info *rli)
{ {
/* /*
It is a common error to set the slave skip counter to 1 instead It is a common error to set the slave skip counter to 1 instead
...@@ -4455,14 +4455,14 @@ void Slave_log_event::pack_info(Protocol *protocol) ...@@ -4455,14 +4455,14 @@ void Slave_log_event::pack_info(Protocol *protocol)
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
Slave_log_event::Slave_log_event(THD* thd_arg, Slave_log_event::Slave_log_event(THD* thd_arg,
RELAY_LOG_INFO* rli) Relay_log_info* rli)
:Log_event(thd_arg, 0, 0) , mem_pool(0), master_host(0) :Log_event(thd_arg, 0, 0) , mem_pool(0), master_host(0)
{ {
DBUG_ENTER("Slave_log_event"); DBUG_ENTER("Slave_log_event");
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);
...@@ -4565,7 +4565,7 @@ Slave_log_event::Slave_log_event(const char* buf, uint event_len) ...@@ -4565,7 +4565,7 @@ Slave_log_event::Slave_log_event(const char* buf, uint event_len)
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
int Slave_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Slave_log_event::do_apply_event(Relay_log_info const *rli)
{ {
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
mysql_bin_log.write(this); mysql_bin_log.write(this);
...@@ -4612,7 +4612,7 @@ void Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) ...@@ -4612,7 +4612,7 @@ void Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
*/ */
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
int Stop_log_event::do_update_pos(RELAY_LOG_INFO *rli) int Stop_log_event::do_update_pos(Relay_log_info *rli)
{ {
/* /*
We do not want to update master_log pos because we get a rotate event We do not want to update master_log pos because we get a rotate event
...@@ -4825,7 +4825,7 @@ void Create_file_log_event::pack_info(Protocol *protocol) ...@@ -4825,7 +4825,7 @@ void Create_file_log_event::pack_info(Protocol *protocol)
*/ */
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Create_file_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Create_file_log_event::do_apply_event(Relay_log_info const *rli)
{ {
char proc_info[17+FN_REFLEN+10], *fname_buf; char proc_info[17+FN_REFLEN+10], *fname_buf;
char *ext; char *ext;
...@@ -5001,7 +5001,7 @@ int Append_block_log_event::get_create_or_append() const ...@@ -5001,7 +5001,7 @@ int Append_block_log_event::get_create_or_append() const
Append_block_log_event::do_apply_event() Append_block_log_event::do_apply_event()
*/ */
int Append_block_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Append_block_log_event::do_apply_event(Relay_log_info const *rli)
{ {
char proc_info[17+FN_REFLEN+10], *fname= proc_info+17; char proc_info[17+FN_REFLEN+10], *fname= proc_info+17;
int fd; int fd;
...@@ -5133,7 +5133,7 @@ void Delete_file_log_event::pack_info(Protocol *protocol) ...@@ -5133,7 +5133,7 @@ void Delete_file_log_event::pack_info(Protocol *protocol)
*/ */
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Delete_file_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Delete_file_log_event::do_apply_event(Relay_log_info const *rli)
{ {
char fname[FN_REFLEN+10]; char fname[FN_REFLEN+10];
char *ext= slave_load_file_stem(fname, file_id, server_id, ".data"); char *ext= slave_load_file_stem(fname, file_id, server_id, ".data");
...@@ -5229,7 +5229,7 @@ void Execute_load_log_event::pack_info(Protocol *protocol) ...@@ -5229,7 +5229,7 @@ void Execute_load_log_event::pack_info(Protocol *protocol)
Execute_load_log_event::do_apply_event() Execute_load_log_event::do_apply_event()
*/ */
int Execute_load_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Execute_load_log_event::do_apply_event(Relay_log_info const *rli)
{ {
char fname[FN_REFLEN+10]; char fname[FN_REFLEN+10];
char *ext; char *ext;
...@@ -5268,7 +5268,7 @@ int Execute_load_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -5268,7 +5268,7 @@ int Execute_load_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
calls mysql_load()). calls mysql_load()).
*/ */
const_cast<RELAY_LOG_INFO*>(rli)->future_group_master_log_pos= log_pos; const_cast<Relay_log_info*>(rli)->future_group_master_log_pos= log_pos;
if (lev->do_apply_event(0,rli,1)) if (lev->do_apply_event(0,rli,1))
{ {
/* /*
...@@ -5478,7 +5478,7 @@ void Execute_load_query_log_event::pack_info(Protocol *protocol) ...@@ -5478,7 +5478,7 @@ void Execute_load_query_log_event::pack_info(Protocol *protocol)
int int
Execute_load_query_log_event::do_apply_event(RELAY_LOG_INFO const *rli) Execute_load_query_log_event::do_apply_event(Relay_log_info const *rli)
{ {
char *p; char *p;
char *buf; char *buf;
...@@ -5867,9 +5867,9 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length) ...@@ -5867,9 +5867,9 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
#endif #endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Rows_log_event::do_apply_event(Relay_log_info const *rli)
{ {
DBUG_ENTER("Rows_log_event::do_apply_event(st_relay_log_info*)"); DBUG_ENTER("Rows_log_event::do_apply_event(Relay_log_info*)");
int error= 0; int error= 0;
uchar const *row_start= m_rows_buf; uchar const *row_start= m_rows_buf;
...@@ -5887,7 +5887,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -5887,7 +5887,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
*/ */
DBUG_ASSERT(get_flags(STMT_END_F)); DBUG_ASSERT(get_flags(STMT_END_F));
const_cast<RELAY_LOG_INFO*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
close_thread_tables(thd); close_thread_tables(thd);
thd->clear_error(); thd->clear_error();
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -5943,7 +5943,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -5943,7 +5943,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
"Error in %s event: when locking tables", "Error in %s event: when locking tables",
get_type_str()); get_type_str());
} }
const_cast<RELAY_LOG_INFO*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -5980,7 +5980,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -5980,7 +5980,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
"unexpected success or fatal error")); "unexpected success or fatal error"));
thd->query_error= 1; thd->query_error= 1;
} }
const_cast<RELAY_LOG_INFO*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(error); DBUG_RETURN(error);
} }
} }
...@@ -6002,7 +6002,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6002,7 +6002,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
mysql_unlock_tables(thd, thd->lock); mysql_unlock_tables(thd, thd->lock);
thd->lock= 0; thd->lock= 0;
thd->query_error= 1; thd->query_error= 1;
const_cast<RELAY_LOG_INFO*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(ERR_BAD_TABLE_DEF); DBUG_RETURN(ERR_BAD_TABLE_DEF);
} }
} }
...@@ -6024,14 +6024,14 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6024,14 +6024,14 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
*/ */
for (TABLE_LIST *ptr= rli->tables_to_lock ; ptr ; ptr= ptr->next_global) for (TABLE_LIST *ptr= rli->tables_to_lock ; ptr ; ptr= ptr->next_global)
{ {
const_cast<RELAY_LOG_INFO*>(rli)->m_table_map.set_table(ptr->table_id, ptr->table); const_cast<Relay_log_info*>(rli)->m_table_map.set_table(ptr->table_id, ptr->table);
} }
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
query_cache.invalidate_locked_for_write(rli->tables_to_lock); query_cache.invalidate_locked_for_write(rli->tables_to_lock);
#endif #endif
} }
TABLE* table= const_cast<RELAY_LOG_INFO*>(rli)->m_table_map.get_table(m_table_id); TABLE* table= const_cast<Relay_log_info*>(rli)->m_table_map.get_table(m_table_id);
if (table) if (table)
{ {
...@@ -6076,7 +6076,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6076,7 +6076,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
inside a statement and halting abruptly might cause problems inside a statement and halting abruptly might cause problems
when restarting. when restarting.
*/ */
const_cast<RELAY_LOG_INFO*>(rli)->set_flag(RELAY_LOG_INFO::IN_STMT); const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
error= do_before_row_operations(table); error= do_before_row_operations(table);
while (error == 0 && row_start < m_rows_end) while (error == 0 && row_start < m_rows_end)
...@@ -6117,7 +6117,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6117,7 +6117,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
row_start= row_end; row_start= row_end;
} }
DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event", DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event",
const_cast<RELAY_LOG_INFO*>(rli)->abort_slave= 1;); const_cast<Relay_log_info*>(rli)->abort_slave= 1;);
error= do_after_row_operations(table, error); error= do_after_row_operations(table, error);
if (!cache_stmt) if (!cache_stmt)
{ {
...@@ -6131,7 +6131,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6131,7 +6131,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
The table def is needed in unpack_row(). The table def is needed in unpack_row().
*/ */
if (rli->tables_to_lock && get_flags(STMT_END_F)) if (rli->tables_to_lock && get_flags(STMT_END_F))
const_cast<RELAY_LOG_INFO*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
if (error) if (error)
{ /* error has occured during the transaction */ { /* error has occured during the transaction */
...@@ -6154,7 +6154,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6154,7 +6154,7 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
rollback at the caller along with sbr. rollback at the caller along with sbr.
*/ */
thd->reset_current_stmt_binlog_row_based(); thd->reset_current_stmt_binlog_row_based();
const_cast<RELAY_LOG_INFO*>(rli)->cleanup_context(thd, error); const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
thd->query_error= 1; thd->query_error= 1;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -6181,16 +6181,16 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6181,16 +6181,16 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
wait (reached end of last relay log and nothing gets appended wait (reached end of last relay log and nothing gets appended
there), we timeout after one minute, and notify DBA about the there), we timeout after one minute, and notify DBA about the
problem. When WL#2975 is implemented, just remove the member problem. When WL#2975 is implemented, just remove the member
st_relay_log_info::last_event_start_time and all its occurences. Relay_log_info::last_event_start_time and all its occurences.
*/ */
const_cast<RELAY_LOG_INFO*>(rli)->last_event_start_time= my_time(0); const_cast<Relay_log_info*>(rli)->last_event_start_time= my_time(0);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} }
Log_event::enum_skip_reason Log_event::enum_skip_reason
Rows_log_event::do_shall_skip(RELAY_LOG_INFO *rli) Rows_log_event::do_shall_skip(Relay_log_info *rli)
{ {
/* /*
If the slave skip counter is 1 and this event does not end a If the slave skip counter is 1 and this event does not end a
...@@ -6204,7 +6204,7 @@ Rows_log_event::do_shall_skip(RELAY_LOG_INFO *rli) ...@@ -6204,7 +6204,7 @@ Rows_log_event::do_shall_skip(RELAY_LOG_INFO *rli)
} }
int int
Rows_log_event::do_update_pos(RELAY_LOG_INFO *rli) Rows_log_event::do_update_pos(Relay_log_info *rli)
{ {
DBUG_ENTER("Rows_log_event::do_update_pos"); DBUG_ENTER("Rows_log_event::do_update_pos");
int error= 0; int error= 0;
...@@ -6647,13 +6647,13 @@ Table_map_log_event::~Table_map_log_event() ...@@ -6647,13 +6647,13 @@ Table_map_log_event::~Table_map_log_event()
*/ */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
{ {
RPL_TABLE_LIST *table_list; RPL_TABLE_LIST *table_list;
char *db_mem, *tname_mem; char *db_mem, *tname_mem;
size_t dummy_len; size_t dummy_len;
void *memory; void *memory;
DBUG_ENTER("Table_map_log_event::do_apply_event(st_relay_log_info*)"); DBUG_ENTER("Table_map_log_event::do_apply_event(Relay_log_info*)");
DBUG_ASSERT(rli->sql_thd == thd); DBUG_ASSERT(rli->sql_thd == thd);
/* Step the query id to mark what columns that are actually used. */ /* Step the query id to mark what columns that are actually used. */
...@@ -6759,7 +6759,7 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6759,7 +6759,7 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
The memory allocated by the table_def structure (i.e., not the The memory allocated by the table_def structure (i.e., not the
memory allocated *for* the table_def structure) is released memory allocated *for* the table_def structure) is released
inside st_relay_log_info::clear_tables_to_lock() by calling the inside Relay_log_info::clear_tables_to_lock() by calling the
table_def destructor explicitly. table_def destructor explicitly.
*/ */
new (&table_list->m_tabledef) table_def(m_coltype, m_colcnt, new (&table_list->m_tabledef) table_def(m_coltype, m_colcnt,
...@@ -6771,8 +6771,8 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6771,8 +6771,8 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
locked by linking the table into the list of tables to lock. locked by linking the table into the list of tables to lock.
*/ */
table_list->next_global= table_list->next_local= rli->tables_to_lock; table_list->next_global= table_list->next_local= rli->tables_to_lock;
const_cast<RELAY_LOG_INFO*>(rli)->tables_to_lock= table_list; const_cast<Relay_log_info*>(rli)->tables_to_lock= table_list;
const_cast<RELAY_LOG_INFO*>(rli)->tables_to_lock_count++; const_cast<Relay_log_info*>(rli)->tables_to_lock_count++;
/* 'memory' is freed in clear_tables_to_lock */ /* 'memory' is freed in clear_tables_to_lock */
} }
...@@ -6784,7 +6784,7 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6784,7 +6784,7 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
} }
Log_event::enum_skip_reason Log_event::enum_skip_reason
Table_map_log_event::do_shall_skip(RELAY_LOG_INFO *rli) Table_map_log_event::do_shall_skip(Relay_log_info *rli)
{ {
/* /*
If the slave skip counter is 1, then we should not start executing If the slave skip counter is 1, then we should not start executing
...@@ -6796,7 +6796,7 @@ Table_map_log_event::do_shall_skip(RELAY_LOG_INFO *rli) ...@@ -6796,7 +6796,7 @@ Table_map_log_event::do_shall_skip(RELAY_LOG_INFO *rli)
return Log_event::do_shall_skip(rli); return Log_event::do_shall_skip(rli);
} }
int Table_map_log_event::do_update_pos(RELAY_LOG_INFO *rli) int Table_map_log_event::do_update_pos(Relay_log_info *rli)
{ {
rli->inc_event_relay_log_pos(); rli->inc_event_relay_log_pos();
return 0; return 0;
...@@ -6998,7 +6998,7 @@ int Write_rows_log_event::do_after_row_operations(TABLE *table, int error) ...@@ -6998,7 +6998,7 @@ int Write_rows_log_event::do_after_row_operations(TABLE *table, int error)
return error? error : local_error; return error? error : local_error;
} }
int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, int Write_rows_log_event::do_prepare_row(THD *thd, Relay_log_info const *rli,
TABLE *table, TABLE *table,
uchar const *const row_start, uchar const *const row_start,
uchar const **const row_end) uchar const **const row_end)
...@@ -7728,7 +7728,7 @@ int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error) ...@@ -7728,7 +7728,7 @@ int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error)
return error; return error;
} }
int Delete_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, int Delete_rows_log_event::do_prepare_row(THD *thd, Relay_log_info const *rli,
TABLE *table, TABLE *table,
uchar const *const row_start, uchar const *const row_start,
uchar const **const row_end) uchar const **const row_end)
...@@ -7904,7 +7904,7 @@ int Update_rows_log_event::do_after_row_operations(TABLE *table, int error) ...@@ -7904,7 +7904,7 @@ int Update_rows_log_event::do_after_row_operations(TABLE *table, int error)
return error; return error;
} }
int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, int Update_rows_log_event::do_prepare_row(THD *thd, Relay_log_info const *rli,
TABLE *table, TABLE *table,
uchar const *const row_start, uchar const *const row_start,
uchar const **const row_end) uchar const **const row_end)
...@@ -8088,7 +8088,7 @@ Incident_log_event::print(FILE *file, ...@@ -8088,7 +8088,7 @@ Incident_log_event::print(FILE *file,
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int int
Incident_log_event::do_apply_event(RELAY_LOG_INFO const *rli) Incident_log_event::do_apply_event(Relay_log_info const *rli)
{ {
DBUG_ENTER("Incident_log_event::do_apply_event"); DBUG_ENTER("Incident_log_event::do_apply_event");
rli->report(ERROR_LEVEL, ER_SLAVE_INCIDENT, rli->report(ERROR_LEVEL, ER_SLAVE_INCIDENT,
......
...@@ -520,9 +520,7 @@ class THD; ...@@ -520,9 +520,7 @@ class THD;
#endif #endif
class Format_description_log_event; class Format_description_log_event;
class Relay_log_info;
struct st_relay_log_info;
typedef st_relay_log_info RELAY_LOG_INFO;
#ifdef MYSQL_CLIENT #ifdef MYSQL_CLIENT
/* /*
...@@ -811,7 +809,7 @@ class Log_event ...@@ -811,7 +809,7 @@ class Log_event
@see do_apply_event @see do_apply_event
*/ */
int apply_event(RELAY_LOG_INFO const *rli) { int apply_event(Relay_log_info const *rli) {
return do_apply_event(rli); return do_apply_event(rli);
} }
...@@ -824,7 +822,7 @@ class Log_event ...@@ -824,7 +822,7 @@ class Log_event
@see do_update_pos @see do_update_pos
*/ */
int update_pos(RELAY_LOG_INFO *rli) int update_pos(Relay_log_info *rli)
{ {
return do_update_pos(rli); return do_update_pos(rli);
} }
...@@ -835,7 +833,7 @@ class Log_event ...@@ -835,7 +833,7 @@ class Log_event
@see do_shall_skip @see do_shall_skip
*/ */
enum_skip_reason shall_skip(RELAY_LOG_INFO *rli) enum_skip_reason shall_skip(Relay_log_info *rli)
{ {
return do_shall_skip(rli); return do_shall_skip(rli);
} }
...@@ -857,7 +855,7 @@ class Log_event ...@@ -857,7 +855,7 @@ class Log_event
@retval 0 Event applied successfully @retval 0 Event applied successfully
@retval errno Error code if event application failed @retval errno Error code if event application failed
*/ */
virtual int do_apply_event(RELAY_LOG_INFO const *rli) virtual int do_apply_event(Relay_log_info const *rli)
{ {
return 0; /* Default implementation does nothing */ return 0; /* Default implementation does nothing */
} }
...@@ -886,7 +884,7 @@ class Log_event ...@@ -886,7 +884,7 @@ class Log_event
1). Observe that handler errors are returned by the 1). Observe that handler errors are returned by the
do_apply_event() function, and not by this one. do_apply_event() function, and not by this one.
*/ */
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
/** /**
...@@ -918,7 +916,7 @@ class Log_event ...@@ -918,7 +916,7 @@ class Log_event
The event shall be skipped because the slave skip counter was The event shall be skipped because the slave skip counter was
non-zero. The caller shall decrease the counter by one. non-zero. The caller shall decrease the counter by one.
*/ */
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif #endif
}; };
...@@ -1059,10 +1057,10 @@ class Query_log_event: public Log_event ...@@ -1059,10 +1057,10 @@ class Query_log_event: public Log_event
public: /* !!! Public in this patch to allow old usage */ public: /* !!! Public in this patch to allow old usage */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
int do_apply_event(RELAY_LOG_INFO const *rli, int do_apply_event(Relay_log_info const *rli,
const char *query_arg, const char *query_arg,
uint32 q_len_arg); uint32 q_len_arg);
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
...@@ -1114,7 +1112,7 @@ class Slave_log_event: public Log_event ...@@ -1114,7 +1112,7 @@ class Slave_log_event: public Log_event
uint16 master_port; uint16 master_port;
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
Slave_log_event(THD* thd_arg, RELAY_LOG_INFO* rli); Slave_log_event(THD* thd_arg, Relay_log_info* rli);
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
#else #else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info); void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
...@@ -1131,7 +1129,7 @@ class Slave_log_event: public Log_event ...@@ -1131,7 +1129,7 @@ class Slave_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const* rli); virtual int do_apply_event(Relay_log_info const* rli);
#endif #endif
}; };
...@@ -1236,12 +1234,12 @@ class Load_log_event: public Log_event ...@@ -1236,12 +1234,12 @@ class Load_log_event: public Log_event
public: /* !!! Public in this patch to allow old usage */ public: /* !!! Public in this patch to allow old usage */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const* rli) virtual int do_apply_event(Relay_log_info const* rli)
{ {
return do_apply_event(thd->slave_net,rli,0); return do_apply_event(thd->slave_net,rli,0);
} }
int do_apply_event(NET *net, RELAY_LOG_INFO const *rli, int do_apply_event(NET *net, Relay_log_info const *rli,
bool use_rli_only_for_errors); bool use_rli_only_for_errors);
#endif #endif
}; };
...@@ -1323,8 +1321,8 @@ class Start_log_event_v3: public Log_event ...@@ -1323,8 +1321,8 @@ class Start_log_event_v3: public Log_event
protected: protected:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO*) virtual enum_skip_reason do_shall_skip(Relay_log_info*)
{ {
/* /*
Events from ourself should be skipped, but they should not Events from ourself should be skipped, but they should not
...@@ -1388,9 +1386,9 @@ class Format_description_log_event: public Start_log_event_v3 ...@@ -1388,9 +1386,9 @@ class Format_description_log_event: public Start_log_event_v3
protected: protected:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif #endif
}; };
...@@ -1432,9 +1430,9 @@ class Intvar_log_event: public Log_event ...@@ -1432,9 +1430,9 @@ class Intvar_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif #endif
}; };
...@@ -1478,9 +1476,9 @@ class Rand_log_event: public Log_event ...@@ -1478,9 +1476,9 @@ class Rand_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif #endif
}; };
...@@ -1521,7 +1519,7 @@ class Xid_log_event: public Log_event ...@@ -1521,7 +1519,7 @@ class Xid_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
#endif #endif
}; };
...@@ -1566,9 +1564,9 @@ class User_var_log_event: public Log_event ...@@ -1566,9 +1564,9 @@ class User_var_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif #endif
}; };
...@@ -1597,8 +1595,8 @@ class Stop_log_event: public Log_event ...@@ -1597,8 +1595,8 @@ class Stop_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli) virtual enum_skip_reason do_shall_skip(Relay_log_info *rli)
{ {
/* /*
Events from ourself should be skipped, but they should not Events from ourself should be skipped, but they should not
...@@ -1657,8 +1655,8 @@ class Rotate_log_event: public Log_event ...@@ -1657,8 +1655,8 @@ class Rotate_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif #endif
}; };
...@@ -1730,7 +1728,7 @@ class Create_file_log_event: public Load_log_event ...@@ -1730,7 +1728,7 @@ class Create_file_log_event: public Load_log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
#endif #endif
}; };
...@@ -1784,7 +1782,7 @@ class Append_block_log_event: public Log_event ...@@ -1784,7 +1782,7 @@ class Append_block_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
#endif #endif
}; };
...@@ -1824,7 +1822,7 @@ class Delete_file_log_event: public Log_event ...@@ -1824,7 +1822,7 @@ class Delete_file_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
#endif #endif
}; };
...@@ -1863,7 +1861,7 @@ class Execute_load_log_event: public Log_event ...@@ -1863,7 +1861,7 @@ class Execute_load_log_event: public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
#endif #endif
}; };
...@@ -1955,7 +1953,7 @@ class Execute_load_query_log_event: public Query_log_event ...@@ -1955,7 +1953,7 @@ class Execute_load_query_log_event: public Query_log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
#endif #endif
}; };
...@@ -2066,9 +2064,9 @@ class Table_map_log_event : public Log_event ...@@ -2066,9 +2064,9 @@ class Table_map_log_event : public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif #endif
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
...@@ -2253,9 +2251,9 @@ class Rows_log_event : public Log_event ...@@ -2253,9 +2251,9 @@ class Rows_log_event : public Log_event
private: private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(Relay_log_info *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
/* /*
Primitive to prepare for a sequence of row executions. Primitive to prepare for a sequence of row executions.
...@@ -2304,7 +2302,7 @@ class Rows_log_event : public Log_event ...@@ -2304,7 +2302,7 @@ class Rows_log_event : public Log_event
RETURN VALUE RETURN VALUE
Error code, if something went wrong, 0 otherwise. Error code, if something went wrong, 0 otherwise.
*/ */
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*,
uchar const *row_start, uchar const *row_start,
uchar const **row_end) = 0; uchar const **row_end) = 0;
...@@ -2376,7 +2374,7 @@ class Write_rows_log_event : public Rows_log_event ...@@ -2376,7 +2374,7 @@ class Write_rows_log_event : public Rows_log_event
virtual int do_before_row_operations(TABLE *table); virtual int do_before_row_operations(TABLE *table);
virtual int do_after_row_operations(TABLE *table, int error); virtual int do_after_row_operations(TABLE *table, int error);
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*,
uchar const *row_start, uchar const **row_end); uchar const *row_start, uchar const **row_end);
virtual int do_exec_row(TABLE *table); virtual int do_exec_row(TABLE *table);
#endif #endif
...@@ -2456,7 +2454,7 @@ class Update_rows_log_event : public Rows_log_event ...@@ -2456,7 +2454,7 @@ class Update_rows_log_event : public Rows_log_event
virtual int do_before_row_operations(TABLE *table); virtual int do_before_row_operations(TABLE *table);
virtual int do_after_row_operations(TABLE *table, int error); virtual int do_after_row_operations(TABLE *table, int error);
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*,
uchar const *row_start, uchar const **row_end); uchar const *row_start, uchar const **row_end);
virtual int do_exec_row(TABLE *table); virtual int do_exec_row(TABLE *table);
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
...@@ -2527,7 +2525,7 @@ class Delete_rows_log_event : public Rows_log_event ...@@ -2527,7 +2525,7 @@ class Delete_rows_log_event : public Rows_log_event
virtual int do_before_row_operations(TABLE *table); virtual int do_before_row_operations(TABLE *table);
virtual int do_after_row_operations(TABLE *table, int error); virtual int do_after_row_operations(TABLE *table, int error);
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*,
uchar const *row_start, uchar const **row_end); uchar const *row_start, uchar const **row_end);
virtual int do_exec_row(TABLE *table); virtual int do_exec_row(TABLE *table);
#endif #endif
...@@ -2605,7 +2603,7 @@ class Incident_log_event : public Log_event { ...@@ -2605,7 +2603,7 @@ class Incident_log_event : public Log_event {
#endif #endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(Relay_log_info const *rli);
#endif #endif
virtual bool write_data_header(IO_CACHE *file); virtual bool write_data_header(IO_CACHE *file);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int int
Write_rows_log_event_old::do_prepare_row(THD *thd, Write_rows_log_event_old::do_prepare_row(THD *thd,
RELAY_LOG_INFO const *rli, Relay_log_info const *rli,
TABLE *table, TABLE *table,
uchar const *row_start, uchar const *row_start,
uchar const **row_end) uchar const **row_end)
...@@ -15,7 +15,7 @@ Write_rows_log_event_old::do_prepare_row(THD *thd, ...@@ -15,7 +15,7 @@ Write_rows_log_event_old::do_prepare_row(THD *thd,
DBUG_ASSERT(row_start && row_end); DBUG_ASSERT(row_start && row_end);
int error; int error;
error= unpack_row_old(const_cast<RELAY_LOG_INFO*>(rli), error= unpack_row_old(const_cast<Relay_log_info*>(rli),
table, m_width, table->record[0], table, m_width, table->record[0],
row_start, &m_cols, row_end, &m_master_reclength, row_start, &m_cols, row_end, &m_master_reclength,
table->write_set, PRE_GA_WRITE_ROWS_EVENT); table->write_set, PRE_GA_WRITE_ROWS_EVENT);
...@@ -26,7 +26,7 @@ Write_rows_log_event_old::do_prepare_row(THD *thd, ...@@ -26,7 +26,7 @@ Write_rows_log_event_old::do_prepare_row(THD *thd,
int int
Delete_rows_log_event_old::do_prepare_row(THD *thd, Delete_rows_log_event_old::do_prepare_row(THD *thd,
RELAY_LOG_INFO const *rli, Relay_log_info const *rli,
TABLE *table, TABLE *table,
uchar const *row_start, uchar const *row_start,
uchar const **row_end) uchar const **row_end)
...@@ -39,7 +39,7 @@ Delete_rows_log_event_old::do_prepare_row(THD *thd, ...@@ -39,7 +39,7 @@ Delete_rows_log_event_old::do_prepare_row(THD *thd,
*/ */
DBUG_ASSERT(table->s->fields >= m_width); DBUG_ASSERT(table->s->fields >= m_width);
error= unpack_row_old(const_cast<RELAY_LOG_INFO*>(rli), error= unpack_row_old(const_cast<Relay_log_info*>(rli),
table, m_width, table->record[0], table, m_width, table->record[0],
row_start, &m_cols, row_end, &m_master_reclength, row_start, &m_cols, row_end, &m_master_reclength,
table->read_set, PRE_GA_DELETE_ROWS_EVENT); table->read_set, PRE_GA_DELETE_ROWS_EVENT);
...@@ -59,7 +59,7 @@ Delete_rows_log_event_old::do_prepare_row(THD *thd, ...@@ -59,7 +59,7 @@ Delete_rows_log_event_old::do_prepare_row(THD *thd,
int Update_rows_log_event_old::do_prepare_row(THD *thd, int Update_rows_log_event_old::do_prepare_row(THD *thd,
RELAY_LOG_INFO const *rli, Relay_log_info const *rli,
TABLE *table, TABLE *table,
uchar const *row_start, uchar const *row_start,
uchar const **row_end) uchar const **row_end)
...@@ -73,13 +73,13 @@ int Update_rows_log_event_old::do_prepare_row(THD *thd, ...@@ -73,13 +73,13 @@ int Update_rows_log_event_old::do_prepare_row(THD *thd,
DBUG_ASSERT(table->s->fields >= m_width); DBUG_ASSERT(table->s->fields >= m_width);
/* record[0] is the before image for the update */ /* record[0] is the before image for the update */
error= unpack_row_old(const_cast<RELAY_LOG_INFO*>(rli), error= unpack_row_old(const_cast<Relay_log_info*>(rli),
table, m_width, table->record[0], table, m_width, table->record[0],
row_start, &m_cols, row_end, &m_master_reclength, row_start, &m_cols, row_end, &m_master_reclength,
table->read_set, PRE_GA_UPDATE_ROWS_EVENT); table->read_set, PRE_GA_UPDATE_ROWS_EVENT);
row_start = *row_end; row_start = *row_end;
/* m_after_image is the after image for the update */ /* m_after_image is the after image for the update */
error= unpack_row_old(const_cast<RELAY_LOG_INFO*>(rli), error= unpack_row_old(const_cast<Relay_log_info*>(rli),
table, m_width, m_after_image, table, m_width, m_after_image,
row_start, &m_cols, row_end, &m_master_reclength, row_start, &m_cols, row_end, &m_master_reclength,
table->write_set, PRE_GA_UPDATE_ROWS_EVENT); table->write_set, PRE_GA_UPDATE_ROWS_EVENT);
......
...@@ -49,7 +49,7 @@ class Write_rows_log_event_old : public Write_rows_log_event ...@@ -49,7 +49,7 @@ class Write_rows_log_event_old : public Write_rows_log_event
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*,
uchar const *row_start, uchar const **row_end); uchar const *row_start, uchar const **row_end);
#endif #endif
}; };
...@@ -83,7 +83,7 @@ class Update_rows_log_event_old : public Update_rows_log_event ...@@ -83,7 +83,7 @@ class Update_rows_log_event_old : public Update_rows_log_event
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*,
uchar const *row_start, uchar const **row_end); uchar const *row_start, uchar const **row_end);
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
}; };
...@@ -117,7 +117,7 @@ class Delete_rows_log_event_old : public Delete_rows_log_event ...@@ -117,7 +117,7 @@ class Delete_rows_log_event_old : public Delete_rows_log_event
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*,
uchar const *row_start, uchar const **row_end); uchar const *row_start, uchar const **row_end);
#endif #endif
}; };
......
...@@ -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];
...@@ -80,7 +80,7 @@ class MASTER_INFO : public Slave_reporting_capability ...@@ -80,7 +80,7 @@ class MASTER_INFO : public Slave_reporting_capability
THD *io_thd; THD *io_thd;
MYSQL* mysql; MYSQL* mysql;
uint32 file_id; /* for 3.23 load data infile */ uint32 file_id; /* for 3.23 load data infile */
RELAY_LOG_INFO rli; Relay_log_info rli;
uint port; uint port;
uint connect_retry; uint connect_retry;
#ifndef DBUG_OFF #ifndef DBUG_OFF
...@@ -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 */
...@@ -188,7 +188,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols, ...@@ -188,7 +188,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
*/ */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int int
unpack_row(RELAY_LOG_INFO const *rli, unpack_row(Relay_log_info const *rli,
TABLE *table, uint const colcnt, TABLE *table, uint const colcnt,
uchar const *const row_data, MY_BITMAP const *cols, uchar const *const row_data, MY_BITMAP const *cols,
uchar const **const row_end, ulong *const master_reclength, uchar const **const row_end, ulong *const master_reclength,
...@@ -217,7 +217,7 @@ unpack_row(RELAY_LOG_INFO const *rli, ...@@ -217,7 +217,7 @@ unpack_row(RELAY_LOG_INFO const *rli,
// The "current" null bits // The "current" null bits
unsigned int null_bits= *null_ptr++; unsigned int null_bits= *null_ptr++;
uint i= 0; uint i= 0;
table_def *tabledef= ((RELAY_LOG_INFO*)rli)->get_tabledef(table); table_def *tabledef= ((Relay_log_info*)rli)->get_tabledef(table);
for (field_ptr= begin_ptr ; field_ptr < end_ptr && *field_ptr ; ++field_ptr) for (field_ptr= begin_ptr ; field_ptr < end_ptr && *field_ptr ; ++field_ptr)
{ {
Field *const f= *field_ptr; Field *const f= *field_ptr;
......
...@@ -22,7 +22,7 @@ size_t pack_row(TABLE* table, MY_BITMAP const* cols, ...@@ -22,7 +22,7 @@ size_t pack_row(TABLE* table, MY_BITMAP const* cols,
#endif #endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int unpack_row(RELAY_LOG_INFO const *rli, int unpack_row(Relay_log_info const *rli,
TABLE *table, uint const colcnt, TABLE *table, uint const colcnt,
uchar const *const row_data, MY_BITMAP const *cols, uchar const *const row_data, MY_BITMAP const *cols,
uchar const **const row_end, ulong *const master_reclength, uchar const **const row_end, ulong *const master_reclength,
......
...@@ -70,7 +70,7 @@ pack_row_old(TABLE *table, MY_BITMAP const* cols, ...@@ -70,7 +70,7 @@ pack_row_old(TABLE *table, MY_BITMAP const* cols,
*/ */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int int
unpack_row_old(RELAY_LOG_INFO *rli, unpack_row_old(Relay_log_info *rli,
TABLE *table, uint const colcnt, uchar *record, TABLE *table, uint const colcnt, uchar *record,
uchar const *row, MY_BITMAP const *cols, uchar const *row, MY_BITMAP const *cols,
uchar const **row_end, ulong *master_reclength, uchar const **row_end, ulong *master_reclength,
......
...@@ -21,7 +21,7 @@ size_t pack_row_old(TABLE *table, MY_BITMAP const* cols, ...@@ -21,7 +21,7 @@ size_t pack_row_old(TABLE *table, MY_BITMAP const* cols,
uchar *row_data, const uchar *record); uchar *row_data, const uchar *record);
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
int unpack_row_old(RELAY_LOG_INFO *rli, int unpack_row_old(Relay_log_info *rli,
TABLE *table, uint const colcnt, uchar *record, TABLE *table, uint const colcnt, uchar *record,
uchar const *row, MY_BITMAP const *cols, uchar const *row, MY_BITMAP const *cols,
uchar const **row_end, ulong *master_reclength, uchar const **row_end, ulong *master_reclength,
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "sql_repl.h" // For check_binlog_magic #include "sql_repl.h" // For check_binlog_magic
#include "rpl_utility.h" #include "rpl_utility.h"
static int count_relay_log_space(RELAY_LOG_INFO* rli); static int count_relay_log_space(Relay_log_info* rli);
// Defined in slave.cc // Defined in slave.cc
int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); int init_intvar_from_file(int* var, IO_CACHE* f, int default_val);
...@@ -29,7 +29,7 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, ...@@ -29,7 +29,7 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val); const char *default_val);
st_relay_log_info::st_relay_log_info() Relay_log_info::Relay_log_info()
:Slave_reporting_capability("SQL"), :Slave_reporting_capability("SQL"),
no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id), no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id),
info_fd(-1), cur_log_fd(-1), save_temporary_tables(0), info_fd(-1), cur_log_fd(-1), save_temporary_tables(0),
...@@ -41,7 +41,7 @@ st_relay_log_info::st_relay_log_info() ...@@ -41,7 +41,7 @@ st_relay_log_info::st_relay_log_info()
tables_to_lock(0), tables_to_lock_count(0), tables_to_lock(0), tables_to_lock_count(0),
last_event_start_time(0), m_flags(0) last_event_start_time(0), m_flags(0)
{ {
DBUG_ENTER("st_relay_log_info::st_relay_log_info"); DBUG_ENTER("Relay_log_info::Relay_log_info");
group_relay_log_name[0]= event_relay_log_name[0]= group_relay_log_name[0]= event_relay_log_name[0]=
group_master_log_name[0]= 0; group_master_log_name[0]= 0;
...@@ -61,9 +61,9 @@ st_relay_log_info::st_relay_log_info() ...@@ -61,9 +61,9 @@ st_relay_log_info::st_relay_log_info()
} }
st_relay_log_info::~st_relay_log_info() Relay_log_info::~Relay_log_info()
{ {
DBUG_ENTER("st_relay_log_info::~st_relay_log_info"); DBUG_ENTER("Relay_log_info::~Relay_log_info");
pthread_mutex_destroy(&run_lock); pthread_mutex_destroy(&run_lock);
pthread_mutex_destroy(&data_lock); pthread_mutex_destroy(&data_lock);
...@@ -77,7 +77,7 @@ st_relay_log_info::~st_relay_log_info() ...@@ -77,7 +77,7 @@ st_relay_log_info::~st_relay_log_info()
} }
int init_relay_log_info(RELAY_LOG_INFO* rli, int init_relay_log_info(Relay_log_info* rli,
const char* info_fname) const char* info_fname)
{ {
char fname[FN_REFLEN+128]; char fname[FN_REFLEN+128];
...@@ -294,7 +294,7 @@ Failed to open the existing relay log info file '%s' (errno %d)", ...@@ -294,7 +294,7 @@ Failed to open the existing relay log info file '%s' (errno %d)",
} }
static inline int add_relay_log(RELAY_LOG_INFO* rli,LOG_INFO* linfo) static inline int add_relay_log(Relay_log_info* rli,LOG_INFO* linfo)
{ {
MY_STAT s; MY_STAT s;
DBUG_ENTER("add_relay_log"); DBUG_ENTER("add_relay_log");
...@@ -313,7 +313,7 @@ static inline int add_relay_log(RELAY_LOG_INFO* rli,LOG_INFO* linfo) ...@@ -313,7 +313,7 @@ static inline int add_relay_log(RELAY_LOG_INFO* rli,LOG_INFO* linfo)
} }
static int count_relay_log_space(RELAY_LOG_INFO* rli) static int count_relay_log_space(Relay_log_info* rli)
{ {
LOG_INFO linfo; LOG_INFO linfo;
DBUG_ENTER("count_relay_log_space"); DBUG_ENTER("count_relay_log_space");
...@@ -339,18 +339,18 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli) ...@@ -339,18 +339,18 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli)
/* /*
Reset UNTIL condition for RELAY_LOG_INFO Reset UNTIL condition for Relay_log_info
SYNOPSYS SYNOPSYS
clear_until_condition() clear_until_condition()
rli - RELAY_LOG_INFO structure where UNTIL condition should be reset rli - Relay_log_info structure where UNTIL condition should be reset
*/ */
void st_relay_log_info::clear_until_condition() void Relay_log_info::clear_until_condition()
{ {
DBUG_ENTER("clear_until_condition"); DBUG_ENTER("clear_until_condition");
until_condition= RELAY_LOG_INFO::UNTIL_NONE; until_condition= Relay_log_info::UNTIL_NONE;
until_log_name[0]= 0; until_log_name[0]= 0;
until_log_pos= 0; until_log_pos= 0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -389,7 +389,7 @@ void st_relay_log_info::clear_until_condition() ...@@ -389,7 +389,7 @@ void st_relay_log_info::clear_until_condition()
1 error. errmsg is set to point to the error message 1 error. errmsg is set to point to the error message
*/ */
int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log, int init_relay_log_pos(Relay_log_info* rli,const char* log,
ulonglong pos, bool need_data_lock, ulonglong pos, bool need_data_lock,
const char** errmsg, const char** errmsg,
bool look_for_description_event) bool look_for_description_event)
...@@ -599,7 +599,7 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log, ...@@ -599,7 +599,7 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
before reaching the desired log/position before reaching the desired log/position
*/ */
int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, int Relay_log_info::wait_for_pos(THD* thd, String* log_name,
longlong log_pos, longlong log_pos,
longlong timeout) longlong timeout)
{ {
...@@ -608,7 +608,7 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, ...@@ -608,7 +608,7 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
int error=0; int error=0;
struct timespec abstime; // for timeout checking struct timespec abstime; // for timeout checking
const char *msg; const char *msg;
DBUG_ENTER("st_relay_log_info::wait_for_pos"); DBUG_ENTER("Relay_log_info::wait_for_pos");
if (!inited) if (!inited)
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -779,10 +779,10 @@ improper_arguments: %d timed_out: %d", ...@@ -779,10 +779,10 @@ improper_arguments: %d timed_out: %d",
} }
void st_relay_log_info::inc_group_relay_log_pos(ulonglong log_pos, void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
bool skip_lock) bool skip_lock)
{ {
DBUG_ENTER("st_relay_log_info::inc_group_relay_log_pos"); DBUG_ENTER("Relay_log_info::inc_group_relay_log_pos");
if (!skip_lock) if (!skip_lock)
pthread_mutex_lock(&data_lock); pthread_mutex_lock(&data_lock);
...@@ -836,10 +836,10 @@ void st_relay_log_info::inc_group_relay_log_pos(ulonglong log_pos, ...@@ -836,10 +836,10 @@ void st_relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
} }
void st_relay_log_info::close_temporary_tables() void Relay_log_info::close_temporary_tables()
{ {
TABLE *table,*next; TABLE *table,*next;
DBUG_ENTER("st_relay_log_info::close_temporary_tables"); DBUG_ENTER("Relay_log_info::close_temporary_tables");
for (table=save_temporary_tables ; table ; table=next) for (table=save_temporary_tables ; table ; table=next)
{ {
...@@ -863,7 +863,7 @@ void st_relay_log_info::close_temporary_tables() ...@@ -863,7 +863,7 @@ void st_relay_log_info::close_temporary_tables()
Assumes to have a run lock on rli and that no slave thread are running. Assumes to have a run lock on rli and that no slave thread are running.
*/ */
int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset, int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
const char** errmsg) const char** errmsg)
{ {
int error=0; int error=0;
...@@ -950,12 +950,12 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset, ...@@ -950,12 +950,12 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset,
/* /*
Check if condition stated in UNTIL clause of START SLAVE is reached. Check if condition stated in UNTIL clause of START SLAVE is reached.
SYNOPSYS SYNOPSYS
st_relay_log_info::is_until_satisfied() Relay_log_info::is_until_satisfied()
DESCRIPTION DESCRIPTION
Checks if UNTIL condition is reached. Uses caching result of last Checks if UNTIL condition is reached. Uses caching result of last
comparison of current log file name and target log file name. So cached comparison of current log file name and target log file name. So cached
value should be invalidated if current log file name changes value should be invalidated if current log file name changes
(see st_relay_log_info::notify_... functions). (see Relay_log_info::notify_... functions).
This caching is needed to avoid of expensive string comparisons and This caching is needed to avoid of expensive string comparisons and
strtol() conversions needed for log names comparison. We don't need to strtol() conversions needed for log names comparison. We don't need to
...@@ -975,11 +975,11 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset, ...@@ -975,11 +975,11 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset,
false - condition not met false - condition not met
*/ */
bool st_relay_log_info::is_until_satisfied() bool Relay_log_info::is_until_satisfied()
{ {
const char *log_name; const char *log_name;
ulonglong log_pos; ulonglong log_pos;
DBUG_ENTER("st_relay_log_info::is_until_satisfied"); DBUG_ENTER("Relay_log_info::is_until_satisfied");
DBUG_ASSERT(until_condition != UNTIL_NONE); DBUG_ASSERT(until_condition != UNTIL_NONE);
...@@ -1055,9 +1055,9 @@ bool st_relay_log_info::is_until_satisfied() ...@@ -1055,9 +1055,9 @@ bool st_relay_log_info::is_until_satisfied()
} }
void st_relay_log_info::cached_charset_invalidate() void Relay_log_info::cached_charset_invalidate()
{ {
DBUG_ENTER("st_relay_log_info::cached_charset_invalidate"); DBUG_ENTER("Relay_log_info::cached_charset_invalidate");
/* Full of zeroes means uninitialized. */ /* Full of zeroes means uninitialized. */
bzero(cached_charset, sizeof(cached_charset)); bzero(cached_charset, sizeof(cached_charset));
...@@ -1065,9 +1065,9 @@ void st_relay_log_info::cached_charset_invalidate() ...@@ -1065,9 +1065,9 @@ void st_relay_log_info::cached_charset_invalidate()
} }
bool st_relay_log_info::cached_charset_compare(char *charset) const bool Relay_log_info::cached_charset_compare(char *charset) const
{ {
DBUG_ENTER("st_relay_log_info::cached_charset_compare"); DBUG_ENTER("Relay_log_info::cached_charset_compare");
if (bcmp((uchar*) cached_charset, (uchar*) charset, if (bcmp((uchar*) cached_charset, (uchar*) charset,
sizeof(cached_charset))) sizeof(cached_charset)))
...@@ -1079,7 +1079,7 @@ bool st_relay_log_info::cached_charset_compare(char *charset) const ...@@ -1079,7 +1079,7 @@ bool st_relay_log_info::cached_charset_compare(char *charset) const
} }
void st_relay_log_info::stmt_done(my_off_t event_master_log_pos, void Relay_log_info::stmt_done(my_off_t event_master_log_pos,
time_t event_creation_time) time_t event_creation_time)
{ {
clear_flag(IN_STMT); clear_flag(IN_STMT);
...@@ -1126,9 +1126,9 @@ void st_relay_log_info::stmt_done(my_off_t event_master_log_pos, ...@@ -1126,9 +1126,9 @@ void st_relay_log_info::stmt_done(my_off_t event_master_log_pos,
} }
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
void st_relay_log_info::cleanup_context(THD *thd, bool error) void Relay_log_info::cleanup_context(THD *thd, bool error)
{ {
DBUG_ENTER("st_relay_log_info::cleanup_context"); DBUG_ENTER("Relay_log_info::cleanup_context");
DBUG_ASSERT(sql_thd == thd); DBUG_ASSERT(sql_thd == thd);
/* /*
...@@ -1156,7 +1156,7 @@ void st_relay_log_info::cleanup_context(THD *thd, bool error) ...@@ -1156,7 +1156,7 @@ void st_relay_log_info::cleanup_context(THD *thd, bool error)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void st_relay_log_info::clear_tables_to_lock() void Relay_log_info::clear_tables_to_lock()
{ {
while (tables_to_lock) while (tables_to_lock)
{ {
......
...@@ -27,16 +27,16 @@ struct RPL_TABLE_LIST; ...@@ -27,16 +27,16 @@ struct RPL_TABLE_LIST;
Replication SQL Thread Replication SQL Thread
st_relay_log_info contains: Relay_log_info contains:
- the current relay log - the current relay log
- the current relay log offset - the current relay log offset
- master log name - master log name
- master log sequence corresponding to the last update - master log sequence corresponding to the last update
- misc information specific to the SQL thread - misc information specific to the SQL thread
st_relay_log_info is initialized from the slave.info file if such exists. Relay_log_info is initialized from the slave.info file if such
Otherwise, data members are intialized with defaults. The initialization is exists. Otherwise, data members are intialized with defaults. The
done with init_relay_log_info() call. initialization is done with init_relay_log_info() call.
The format of slave.info file: The format of slave.info file:
...@@ -49,8 +49,9 @@ struct RPL_TABLE_LIST; ...@@ -49,8 +49,9 @@ struct RPL_TABLE_LIST;
*****************************************************************************/ *****************************************************************************/
typedef struct st_relay_log_info : public Slave_reporting_capability class Relay_log_info : public Slave_reporting_capability
{ {
public:
/** /**
Flags for the state of the replication. Flags for the state of the replication.
*/ */
...@@ -120,8 +121,8 @@ typedef struct st_relay_log_info : public Slave_reporting_capability ...@@ -120,8 +121,8 @@ typedef struct st_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; 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
...@@ -255,8 +256,8 @@ typedef struct st_relay_log_info : public Slave_reporting_capability ...@@ -255,8 +256,8 @@ typedef struct st_relay_log_info : public Slave_reporting_capability
char ign_master_log_name_end[FN_REFLEN]; char ign_master_log_name_end[FN_REFLEN];
ulonglong ign_master_log_pos_end; ulonglong ign_master_log_pos_end;
st_relay_log_info(); Relay_log_info();
~st_relay_log_info(); ~Relay_log_info();
/* /*
Invalidate cached until_log_name and group_relay_log_name comparison Invalidate cached until_log_name and group_relay_log_name comparison
...@@ -391,11 +392,11 @@ typedef struct st_relay_log_info : public Slave_reporting_capability ...@@ -391,11 +392,11 @@ typedef struct st_relay_log_info : public Slave_reporting_capability
private: private:
uint32 m_flags; uint32 m_flags;
} RELAY_LOG_INFO; };
// Defined in rpl_rli.cc // Defined in rpl_rli.cc
int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname); int init_relay_log_info(Relay_log_info* rli, const char* info_fname);
#endif /* RPL_RLI_H */ #endif /* RPL_RLI_H */
...@@ -164,7 +164,7 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) ...@@ -164,7 +164,7 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data)
*/ */
int int
table_def::compatible_with(RELAY_LOG_INFO const *rli_arg, TABLE *table) table_def::compatible_with(Relay_log_info const *rli_arg, TABLE *table)
const const
{ {
/* /*
...@@ -172,7 +172,7 @@ table_def::compatible_with(RELAY_LOG_INFO const *rli_arg, TABLE *table) ...@@ -172,7 +172,7 @@ table_def::compatible_with(RELAY_LOG_INFO const *rli_arg, TABLE *table)
*/ */
uint const cols_to_check= min(table->s->fields, size()); uint const cols_to_check= min(table->s->fields, size());
int error= 0; int error= 0;
RELAY_LOG_INFO const *rli= const_cast<RELAY_LOG_INFO*>(rli_arg); Relay_log_info const *rli= const_cast<Relay_log_info*>(rli_arg);
TABLE_SHARE const *const tsh= table->s; TABLE_SHARE const *const tsh= table->s;
......
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
#include "mysql_priv.h" #include "mysql_priv.h"
struct st_relay_log_info; class Relay_log_info;
typedef st_relay_log_info RELAY_LOG_INFO;
/** /**
...@@ -237,7 +236,7 @@ class table_def ...@@ -237,7 +236,7 @@ class table_def
@retval 1 if the table definition is not compatible with @c table @retval 1 if the table definition is not compatible with @c table
@retval 0 if the table definition is compatible with @c table @retval 0 if the table definition is compatible with @c table
*/ */
int compatible_with(RELAY_LOG_INFO const *rli, TABLE *table) const; int compatible_with(Relay_log_info const *rli, TABLE *table) const;
private: private:
ulong m_size; // Number of elements in the types array ulong m_size; // Number of elements in the types array
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
#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);
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"") #define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
...@@ -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,24 +114,24 @@ failed read" ...@@ -114,24 +114,24 @@ 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);
/* /*
Find out which replications threads are running Find out which replications threads are running
...@@ -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");
...@@ -559,7 +559,7 @@ static bool io_slave_killed(THD* thd, MASTER_INFO* mi) ...@@ -559,7 +559,7 @@ static bool io_slave_killed(THD* thd, MASTER_INFO* mi)
} }
static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli) static bool sql_slave_killed(THD* thd, Relay_log_info* rli)
{ {
DBUG_ENTER("sql_slave_killed"); DBUG_ENTER("sql_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;
...@@ -1073,10 +1073,10 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, ...@@ -1073,10 +1073,10 @@ 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,9 +1108,9 @@ Waiting for the slave SQL thread to free enough relay log space"); ...@@ -1108,9 +1108,9 @@ 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();
DBUG_ENTER("write_ignored_events_info_to_relay_log"); DBUG_ENTER("write_ignored_events_info_to_relay_log");
...@@ -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;
...@@ -1322,8 +1322,8 @@ bool show_master_info(THD* thd, MASTER_INFO* mi) ...@@ -1322,8 +1322,8 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
protocol->store((ulonglong) mi->rli.log_space_total); protocol->store((ulonglong) mi->rli.log_space_total);
protocol->store( protocol->store(
mi->rli.until_condition==RELAY_LOG_INFO::UNTIL_NONE ? "None": mi->rli.until_condition==Relay_log_info::UNTIL_NONE ? "None":
( mi->rli.until_condition==RELAY_LOG_INFO::UNTIL_MASTER_POS? "Master": ( mi->rli.until_condition==Relay_log_info::UNTIL_MASTER_POS? "Master":
"Relay"), &my_charset_bin); "Relay"), &my_charset_bin);
protocol->store(mi->rli.until_log_name, &my_charset_bin); protocol->store(mi->rli.until_log_name, &my_charset_bin);
protocol->store((ulonglong) mi->rli.until_log_pos); protocol->store((ulonglong) mi->rli.until_log_pos);
...@@ -1419,7 +1419,7 @@ void set_slave_thread_options(THD* thd) ...@@ -1419,7 +1419,7 @@ void set_slave_thread_options(THD* thd)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
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)
{ {
DBUG_ENTER("set_slave_thread_default_charset"); DBUG_ENTER("set_slave_thread_default_charset");
...@@ -1437,7 +1437,7 @@ void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO const *rli) ...@@ -1437,7 +1437,7 @@ void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO const *rli)
the thread. That the cache has to be invalidated is a secondary the thread. That the cache has to be invalidated is a secondary
effect. effect.
*/ */
const_cast<RELAY_LOG_INFO*>(rli)->cached_charset_invalidate(); const_cast<Relay_log_info*>(rli)->cached_charset_invalidate();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -1515,7 +1515,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, ...@@ -1515,7 +1515,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];
...@@ -1599,7 +1599,7 @@ command"); ...@@ -1599,7 +1599,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");
...@@ -1647,7 +1647,7 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings) ...@@ -1647,7 +1647,7 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings)
} }
int check_expected_error(THD* thd, RELAY_LOG_INFO const *rli, int check_expected_error(THD* thd, Relay_log_info const *rli,
int expected_error) int expected_error)
{ {
DBUG_ENTER("check_expected_error"); DBUG_ENTER("check_expected_error");
...@@ -1709,7 +1709,7 @@ static int has_temporary_error(THD *thd) ...@@ -1709,7 +1709,7 @@ static int has_temporary_error(THD *thd)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
{ {
DBUG_ENTER("exec_relay_log_event"); DBUG_ENTER("exec_relay_log_event");
...@@ -1727,7 +1727,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) ...@@ -1727,7 +1727,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
was an event ignored by the I/O thread just before (BUG#13861 to be was an event ignored by the I/O thread just before (BUG#13861 to be
fixed). fixed).
*/ */
if (rli->until_condition!=RELAY_LOG_INFO::UNTIL_NONE && if (rli->until_condition!=Relay_log_info::UNTIL_NONE &&
rli->is_until_satisfied()) rli->is_until_satisfied())
{ {
char buf[22]; char buf[22];
...@@ -1944,7 +1944,7 @@ on this slave.\ ...@@ -1944,7 +1944,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))
{ {
...@@ -1982,7 +1982,7 @@ static bool check_io_slave_killed(THD *thd, MASTER_INFO *mi, const char *info) ...@@ -1982,7 +1982,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])
{ {
...@@ -2038,8 +2038,8 @@ pthread_handler_t handle_slave_io(void *arg) ...@@ -2038,8 +2038,8 @@ 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;
bool suppress_warnings; bool suppress_warnings;
...@@ -2312,7 +2312,7 @@ log space"); ...@@ -2312,7 +2312,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
...@@ -2344,7 +2344,7 @@ pthread_handler_t handle_slave_sql(void *arg) ...@@ -2344,7 +2344,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
...@@ -2613,7 +2613,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ ...@@ -2613,7 +2613,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;
...@@ -2740,7 +2740,7 @@ static int process_io_create_file(MASTER_INFO* mi, Create_file_log_event* cev) ...@@ -2740,7 +2740,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);
...@@ -2788,14 +2788,14 @@ static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) ...@@ -2788,14 +2788,14 @@ 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;
ulong inc_pos; ulong inc_pos;
bool ignore_event= 0; bool ignore_event= 0;
char *tmp_buf = 0; char *tmp_buf = 0;
RELAY_LOG_INFO *rli= &mi->rli; Relay_log_info *rli= &mi->rli;
DBUG_ENTER("queue_binlog_ver_1_event"); DBUG_ENTER("queue_binlog_ver_1_event");
/* /*
...@@ -2906,13 +2906,13 @@ static int queue_binlog_ver_1_event(MASTER_INFO *mi, const char *buf, ...@@ -2906,13 +2906,13 @@ 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;
ulong inc_pos; ulong inc_pos;
char *tmp_buf = 0; char *tmp_buf = 0;
RELAY_LOG_INFO *rli= &mi->rli; Relay_log_info *rli= &mi->rli;
DBUG_ENTER("queue_binlog_ver_3_event"); DBUG_ENTER("queue_binlog_ver_3_event");
/* read_log_event() will adjust log_pos to be end_log_pos */ /* read_log_event() will adjust log_pos to be end_log_pos */
...@@ -2970,7 +2970,7 @@ static int queue_binlog_ver_3_event(MASTER_INFO *mi, const char *buf, ...@@ -2970,7 +2970,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");
...@@ -2998,11 +2998,11 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, ...@@ -2998,11 +2998,11 @@ 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;
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();
DBUG_ENTER("queue_event"); DBUG_ENTER("queue_event");
...@@ -3154,7 +3154,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) ...@@ -3154,7 +3154,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
} }
void end_relay_log_info(RELAY_LOG_INFO* rli) void end_relay_log_info(Relay_log_info* rli)
{ {
DBUG_ENTER("end_relay_log_info"); DBUG_ENTER("end_relay_log_info");
...@@ -3198,7 +3198,7 @@ void end_relay_log_info(RELAY_LOG_INFO* rli) ...@@ -3198,7 +3198,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");
...@@ -3215,7 +3215,7 @@ static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi) ...@@ -3215,7 +3215,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;
...@@ -3321,7 +3321,7 @@ replication resumed in log '%s' at position %s", mi->user, ...@@ -3321,7 +3321,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");
...@@ -3358,7 +3358,7 @@ static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi, ...@@ -3358,7 +3358,7 @@ static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi,
1 write error 1 write error
*/ */
bool flush_relay_log_info(RELAY_LOG_INFO* rli) bool flush_relay_log_info(Relay_log_info* rli)
{ {
bool error=0; bool error=0;
DBUG_ENTER("flush_relay_log_info"); DBUG_ENTER("flush_relay_log_info");
...@@ -3392,7 +3392,7 @@ bool flush_relay_log_info(RELAY_LOG_INFO* rli) ...@@ -3392,7 +3392,7 @@ bool flush_relay_log_info(RELAY_LOG_INFO* rli)
Called when we notice that the current "hot" log got rotated under our feet. Called when we notice that the current "hot" log got rotated under our feet.
*/ */
static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg) static IO_CACHE *reopen_relay_log(Relay_log_info *rli, const char **errmsg)
{ {
DBUG_ENTER("reopen_relay_log"); DBUG_ENTER("reopen_relay_log");
DBUG_ASSERT(rli->cur_log != &rli->cache_buf); DBUG_ASSERT(rli->cur_log != &rli->cache_buf);
...@@ -3413,7 +3413,7 @@ static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg) ...@@ -3413,7 +3413,7 @@ static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg)
} }
static Log_event* next_event(RELAY_LOG_INFO* rli) static Log_event* next_event(Relay_log_info* rli)
{ {
Log_event* ev; Log_event* ev;
IO_CACHE* cur_log = rli->cur_log; IO_CACHE* cur_log = rli->cur_log;
...@@ -3605,10 +3605,10 @@ static Log_event* next_event(RELAY_LOG_INFO* rli) ...@@ -3605,10 +3605,10 @@ static Log_event* next_event(RELAY_LOG_INFO* rli)
// prevent the I/O thread from blocking next times // prevent the I/O thread from blocking next times
rli->ignore_log_space_limit= 1; rli->ignore_log_space_limit= 1;
/* /*
If the I/O thread is blocked, unblock it. If the I/O thread is blocked, unblock it. Ok to broadcast
Ok to broadcast after unlock, because the mutex is only destroyed in after unlock, because the mutex is only destroyed in
~st_relay_log_info(), i.e. when rli is destroyed, and rli will not be ~Relay_log_info(), i.e. when rli is destroyed, and rli will
destroyed before we exit the present function. not be destroyed before we exit the present function.
*/ */
pthread_mutex_unlock(&rli->log_space_lock); pthread_mutex_unlock(&rli->log_space_lock);
pthread_cond_broadcast(&rli->log_space_cond); pthread_cond_broadcast(&rli->log_space_cond);
...@@ -3765,10 +3765,10 @@ event(errno: %d cur_log->error: %d)", ...@@ -3765,10 +3765,10 @@ 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;
/* We don't lock rli->run_lock. This would lead to deadlocks. */ /* We don't lock rli->run_lock. This would lead to deadlocks. */
pthread_mutex_lock(&mi->run_lock); pthread_mutex_lock(&mi->run_lock);
...@@ -3809,11 +3809,11 @@ void rotate_relay_log(MASTER_INFO* mi) ...@@ -3809,11 +3809,11 @@ void rotate_relay_log(MASTER_INFO* mi)
/** /**
Detects, based on master's version (as found in the relay log), if master Detects, based on master's version (as found in the relay log), if master
has a certain bug. has a certain bug.
@param rli RELAY_LOG_INFO which tells the master's version @param rli Relay_log_info which tells the master's version
@param bug_id Number of the bug as found in bugs.mysql.com @param bug_id Number of the bug as found in bugs.mysql.com
@return TRUE if master has the bug, FALSE if it does not. @return TRUE if master has the bug, FALSE if it does not.
*/ */
bool rpl_master_has_bug(RELAY_LOG_INFO *rli, uint bug_id) bool rpl_master_has_bug(Relay_log_info *rli, uint bug_id)
{ {
struct st_version_range_for_one_bug { struct st_version_range_for_one_bug {
uint bug_id; uint bug_id;
......
...@@ -29,10 +29,9 @@ ...@@ -29,10 +29,9 @@
// Forward declarations // Forward declarations
struct st_relay_log_info; class Relay_log_info;
typedef st_relay_log_info RELAY_LOG_INFO; class Master_info;
class MASTER_INFO;
/***************************************************************************** /*****************************************************************************
...@@ -43,11 +42,11 @@ class MASTER_INFO; ...@@ -43,11 +42,11 @@ 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
file, executing each event. A RELAY_LOG_INFO file, executing each event. A Relay_log_info
represents this thread. represents this thread.
Buffering in the relay log file makes it unnecessary to reread events from Buffering in the relay log file makes it unnecessary to reread events from
...@@ -70,18 +69,18 @@ class MASTER_INFO; ...@@ -70,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.
...@@ -102,12 +101,12 @@ extern my_bool opt_log_slave_updates; ...@@ -102,12 +101,12 @@ 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
these values. these values.
The same way, code is assuming that in RELAY_LOG_INFO we use only values The same way, code is assuming that in Relay_log_info we use only values
0/1. 0/1.
I started with using an enum, but I started with using an enum, but
enum_variable=1; is not legal so would have required many line changes. enum_variable=1; is not legal so would have required many line changes.
...@@ -129,16 +128,16 @@ extern ulonglong relay_log_space_limit; ...@@ -129,16 +128,16 @@ extern ulonglong relay_log_space_limit;
int init_slave(); 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
...@@ -151,7 +150,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock, ...@@ -151,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 */
...@@ -160,37 +159,37 @@ int mysql_table_dump(THD* thd, const char* db, ...@@ -160,37 +159,37 @@ 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);
const char *print_slave_db_safe(const char *db); const char *print_slave_db_safe(const char *db);
int check_expected_error(THD* thd, RELAY_LOG_INFO const *rli, int error_code); int check_expected_error(THD* thd, Relay_log_info const *rli, int error_code);
void skip_load_data_infile(NET* net); void skip_load_data_infile(NET* net);
void end_slave(); /* clean up */ 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);
int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset, 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;
......
...@@ -52,7 +52,7 @@ void mysql_client_binlog_statement(THD* thd) ...@@ -52,7 +52,7 @@ void mysql_client_binlog_statement(THD* thd)
Allocation Allocation
*/ */
if (!thd->rli_fake) if (!thd->rli_fake)
thd->rli_fake= new RELAY_LOG_INFO; thd->rli_fake= new Relay_log_info;
const Format_description_log_event *desc= const Format_description_log_event *desc=
new Format_description_log_event(4); new Format_description_log_event(4);
......
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
#include "log.h" #include "log.h"
#include "rpl_tblmap.h" #include "rpl_tblmap.h"
struct st_relay_log_info; class Relay_log_info;
typedef st_relay_log_info RELAY_LOG_INFO;
class Query_log_event; class Query_log_event;
class Load_log_event; class Load_log_event;
...@@ -970,7 +969,7 @@ class THD :public Statement, ...@@ -970,7 +969,7 @@ class THD :public Statement,
{ {
public: public:
/* Used to execute base64 coded binlog events in MySQL server */ /* Used to execute base64 coded binlog events in MySQL server */
RELAY_LOG_INFO* rli_fake; Relay_log_info* rli_fake;
/* /*
Constant for THD::where initialization in the beginning of every query. Constant for THD::where initialization in the beginning of every query.
......
...@@ -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;
...@@ -799,7 +799,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -799,7 +799,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
if (thd->lex->mi.pos) if (thd->lex->mi.pos)
{ {
mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_MASTER_POS; mi->rli.until_condition= Relay_log_info::UNTIL_MASTER_POS;
mi->rli.until_log_pos= thd->lex->mi.pos; mi->rli.until_log_pos= thd->lex->mi.pos;
/* /*
We don't check thd->lex->mi.log_file_name for NULL here We don't check thd->lex->mi.log_file_name for NULL here
...@@ -810,7 +810,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -810,7 +810,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
} }
else if (thd->lex->mi.relay_log_pos) else if (thd->lex->mi.relay_log_pos)
{ {
mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_RELAY_POS; mi->rli.until_condition= Relay_log_info::UNTIL_RELAY_POS;
mi->rli.until_log_pos= thd->lex->mi.relay_log_pos; mi->rli.until_log_pos= thd->lex->mi.relay_log_pos;
strmake(mi->rli.until_log_name, thd->lex->mi.relay_log_name, strmake(mi->rli.until_log_name, thd->lex->mi.relay_log_name,
sizeof(mi->rli.until_log_name)-1); sizeof(mi->rli.until_log_name)-1);
...@@ -818,7 +818,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -818,7 +818,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
else else
mi->rli.clear_until_condition(); mi->rli.clear_until_condition();
if (mi->rli.until_condition != RELAY_LOG_INFO::UNTIL_NONE) if (mi->rli.until_condition != Relay_log_info::UNTIL_NONE)
{ {
/* Preparing members for effective until condition checking */ /* Preparing members for effective until condition checking */
const char *p= fn_ext(mi->rli.until_log_name); const char *p= fn_ext(mi->rli.until_log_name);
...@@ -840,7 +840,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -840,7 +840,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
/* mark the cached result of the UNTIL comparison as "undefined" */ /* mark the cached result of the UNTIL comparison as "undefined" */
mi->rli.until_log_names_cmp_result= mi->rli.until_log_names_cmp_result=
RELAY_LOG_INFO::UNTIL_LOG_NAMES_CMP_UNKNOWN; Relay_log_info::UNTIL_LOG_NAMES_CMP_UNKNOWN;
/* Issuing warning then started without --skip-slave-start */ /* Issuing warning then started without --skip-slave-start */
if (!opt_skip_slave_start) if (!opt_skip_slave_start)
...@@ -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