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,
*/
#ifdef HAVE_NDB_BINLOG
extern MASTER_INFO *active_mi;
extern Master_info *active_mi;
static int ndbcluster_update_apply_status(THD *thd, int do_update)
{
Thd_ndb *thd_ndb= get_thd_ndb(thd);
......
......@@ -2734,7 +2734,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
#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;
DBUG_ENTER("purge_first_log");
......
......@@ -16,7 +16,7 @@
#ifndef LOG_H
#define LOG_H
struct st_relay_log_info;
class Relay_log_info;
class Format_description_log_event;
......@@ -121,7 +121,7 @@ extern TC_LOG_DUMMY tc_log_dummy;
#define LOG_CLOSE_TO_BE_OPENED 2
#define LOG_CLOSE_STOP_EVENT 4
struct st_relay_log_info;
class Relay_log_info;
typedef struct st_log_info
{
......@@ -362,7 +362,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
bool need_mutex, bool need_update_threads,
ulonglong *decrease_log_space);
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);
void close(uint exiting);
......
This diff is collapsed.
This diff is collapsed.
......@@ -6,7 +6,7 @@
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int
Write_rows_log_event_old::do_prepare_row(THD *thd,
RELAY_LOG_INFO const *rli,
Relay_log_info const *rli,
TABLE *table,
uchar const *row_start,
uchar const **row_end)
......@@ -15,7 +15,7 @@ Write_rows_log_event_old::do_prepare_row(THD *thd,
DBUG_ASSERT(row_start && row_end);
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],
row_start, &m_cols, row_end, &m_master_reclength,
table->write_set, PRE_GA_WRITE_ROWS_EVENT);
......@@ -26,7 +26,7 @@ Write_rows_log_event_old::do_prepare_row(THD *thd,
int
Delete_rows_log_event_old::do_prepare_row(THD *thd,
RELAY_LOG_INFO const *rli,
Relay_log_info const *rli,
TABLE *table,
uchar const *row_start,
uchar const **row_end)
......@@ -39,7 +39,7 @@ Delete_rows_log_event_old::do_prepare_row(THD *thd,
*/
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],
row_start, &m_cols, row_end, &m_master_reclength,
table->read_set, PRE_GA_DELETE_ROWS_EVENT);
......@@ -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,
RELAY_LOG_INFO const *rli,
Relay_log_info const *rli,
TABLE *table,
uchar const *row_start,
uchar const **row_end)
......@@ -73,13 +73,13 @@ int Update_rows_log_event_old::do_prepare_row(THD *thd,
DBUG_ASSERT(table->s->fields >= m_width);
/* 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],
row_start, &m_cols, row_end, &m_master_reclength,
table->read_set, PRE_GA_UPDATE_ROWS_EVENT);
row_start = *row_end;
/* 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,
row_start, &m_cols, row_end, &m_master_reclength,
table->write_set, PRE_GA_UPDATE_ROWS_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; }
#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);
#endif
};
......@@ -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; }
#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);
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
};
......@@ -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; }
#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);
#endif
};
......
......@@ -492,7 +492,7 @@ bool show_new_master(THD* thd)
0 success
*/
int update_slave_list(MYSQL* mysql, MASTER_INFO* mi)
int update_slave_list(MYSQL* mysql, Master_info* mi)
{
MYSQL_RES* res=0;
MYSQL_ROW row;
......@@ -679,7 +679,7 @@ bool show_slave_hosts(THD* thd)
}
int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
int connect_to_master(THD *thd, MYSQL* mysql, Master_info* mi)
{
DBUG_ENTER("connect_to_master");
......@@ -728,7 +728,7 @@ static inline void cleanup_mysql_results(MYSQL_RES* db_res,
static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
MYSQL_RES *table_res, MASTER_INFO *mi)
MYSQL_RES *table_res, Master_info *mi)
{
MYSQL_ROW row;
for (row = mysql_fetch_row(table_res); row;
......
......@@ -33,12 +33,12 @@ extern const char* rpl_role_type[], *rpl_status_type[];
pthread_handler_t handle_failsafe_rpl(void *arg);
void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status);
int find_recovery_captain(THD* thd, MYSQL* mysql);
int update_slave_list(MYSQL* mysql, MASTER_INFO* mi);
int update_slave_list(MYSQL* mysql, Master_info* mi);
extern HASH slave_list;
bool load_master_data(THD* thd);
int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi);
int connect_to_master(THD *thd, MYSQL* mysql, Master_info* mi);
bool show_new_master(THD* thd);
bool show_slave_hosts(THD* thd);
......
......@@ -27,7 +27,7 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val);
int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val);
MASTER_INFO::MASTER_INFO()
Master_info::Master_info()
:Slave_reporting_capability("I/O"),
ssl(0), fd(-1), io_thd(0), inited(0),
abort_slave(0),slave_running(0),
......@@ -45,7 +45,7 @@ MASTER_INFO::MASTER_INFO()
pthread_cond_init(&stop_cond, NULL);
}
MASTER_INFO::~MASTER_INFO()
Master_info::~Master_info()
{
pthread_mutex_destroy(&run_lock);
pthread_mutex_destroy(&data_lock);
......@@ -55,7 +55,7 @@ MASTER_INFO::~MASTER_INFO()
}
void init_master_info_with_options(MASTER_INFO* mi)
void init_master_info_with_options(Master_info* mi)
{
DBUG_ENTER("init_master_info_with_options");
......@@ -98,7 +98,7 @@ enum {
LINES_IN_MASTER_INFO= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT
};
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
int init_master_info(Master_info* mi, const char* master_info_fname,
const char* slave_info_fname,
bool abort_if_no_master_info_file,
int thread_mask)
......@@ -338,7 +338,7 @@ file '%s')", fname);
1 - flush master info failed
0 - all ok
*/
int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
{
IO_CACHE* file = &mi->file;
char lbuf[22];
......@@ -392,7 +392,7 @@ int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
}
void end_master_info(MASTER_INFO* mi)
void end_master_info(Master_info* mi)
{
DBUG_ENTER("end_master_info");
......
......@@ -26,13 +26,13 @@
Replication IO Thread
MASTER_INFO contains:
Master_info contains:
- information about how to connect to a master
- current master log name
- current master log offset
- misc control variables
MASTER_INFO is initialized once from the master.info file if such
Master_info is initialized once from the master.info file if such
exists. Otherwise, data members corresponding to master.info fields
are initialized with defaults specified by master-* options. The
initialization is done through init_master_info() call.
......@@ -55,11 +55,11 @@
*****************************************************************************/
class MASTER_INFO : public Slave_reporting_capability
class Master_info : public Slave_reporting_capability
{
public:
MASTER_INFO();
~MASTER_INFO();
Master_info();
~Master_info();
/* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN];
......@@ -80,7 +80,7 @@ class MASTER_INFO : public Slave_reporting_capability
THD *io_thd;
MYSQL* mysql;
uint32 file_id; /* for 3.23 load data infile */
RELAY_LOG_INFO rli;
Relay_log_info rli;
uint port;
uint connect_retry;
#ifndef DBUG_OFF
......@@ -102,13 +102,13 @@ class MASTER_INFO : public Slave_reporting_capability
long clock_diff_with_master;
};
void init_master_info_with_options(MASTER_INFO* mi);
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
void init_master_info_with_options(Master_info* mi);
int init_master_info(Master_info* mi, const char* master_info_fname,
const char* slave_info_fname,
bool abort_if_no_master_info_file,
int thread_mask);
void end_master_info(MASTER_INFO* mi);
int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache);
void end_master_info(Master_info* mi);
int flush_master_info(Master_info* mi, bool flush_relay_log_cache);
#endif /* HAVE_REPLICATION */
#endif /* RPL_MI_H */
......@@ -188,7 +188,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
*/
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int
unpack_row(RELAY_LOG_INFO const *rli,
unpack_row(Relay_log_info const *rli,
TABLE *table, uint const colcnt,
uchar const *const row_data, MY_BITMAP const *cols,
uchar const **const row_end, ulong *const master_reclength,
......@@ -217,7 +217,7 @@ unpack_row(RELAY_LOG_INFO const *rli,
// The "current" null bits
unsigned int null_bits= *null_ptr++;
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)
{
Field *const f= *field_ptr;
......
......@@ -22,7 +22,7 @@ size_t pack_row(TABLE* table, MY_BITMAP const* cols,
#endif
#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,
uchar const *const row_data, MY_BITMAP const *cols,
uchar const **const row_end, ulong *const master_reclength,
......
......@@ -70,7 +70,7 @@ pack_row_old(TABLE *table, MY_BITMAP const* cols,
*/
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int
unpack_row_old(RELAY_LOG_INFO *rli,
unpack_row_old(Relay_log_info *rli,
TABLE *table, uint const colcnt, uchar *record,
uchar const *row, MY_BITMAP const *cols,
uchar const **row_end, ulong *master_reclength,
......
......@@ -21,7 +21,7 @@ size_t pack_row_old(TABLE *table, MY_BITMAP const* cols,
uchar *row_data, const uchar *record);
#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,
uchar const *row, MY_BITMAP const *cols,
uchar const **row_end, ulong *master_reclength,
......
......@@ -21,7 +21,7 @@
#include "sql_repl.h" // For check_binlog_magic
#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
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,
const char *default_val);
st_relay_log_info::st_relay_log_info()
Relay_log_info::Relay_log_info()
:Slave_reporting_capability("SQL"),
no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id),
info_fd(-1), cur_log_fd(-1), save_temporary_tables(0),
......@@ -41,7 +41,7 @@ st_relay_log_info::st_relay_log_info()
tables_to_lock(0), tables_to_lock_count(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_master_log_name[0]= 0;
......@@ -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(&data_lock);
......@@ -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)
{
char fname[FN_REFLEN+128];
......@@ -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;
DBUG_ENTER("add_relay_log");
......@@ -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;
DBUG_ENTER("count_relay_log_space");
......@@ -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
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");
until_condition= RELAY_LOG_INFO::UNTIL_NONE;
until_condition= Relay_log_info::UNTIL_NONE;
until_log_name[0]= 0;
until_log_pos= 0;
DBUG_VOID_RETURN;
......@@ -389,7 +389,7 @@ void st_relay_log_info::clear_until_condition()
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,
const char** errmsg,
bool look_for_description_event)
......@@ -599,7 +599,7 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
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 timeout)
{
......@@ -608,7 +608,7 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
int error=0;
struct timespec abstime; // for timeout checking
const char *msg;
DBUG_ENTER("st_relay_log_info::wait_for_pos");
DBUG_ENTER("Relay_log_info::wait_for_pos");
if (!inited)
DBUG_RETURN(-1);
......@@ -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)
{
DBUG_ENTER("st_relay_log_info::inc_group_relay_log_pos");
DBUG_ENTER("Relay_log_info::inc_group_relay_log_pos");
if (!skip_lock)
pthread_mutex_lock(&data_lock);
......@@ -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;
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)
{
......@@ -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.
*/
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)
{
int error=0;
......@@ -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.
SYNOPSYS
st_relay_log_info::is_until_satisfied()
Relay_log_info::is_until_satisfied()
DESCRIPTION
Checks if UNTIL condition is reached. Uses caching result of last
comparison of current log file name and target log file name. So cached
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
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,
false - condition not met
*/
bool st_relay_log_info::is_until_satisfied()
bool Relay_log_info::is_until_satisfied()
{
const char *log_name;
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);
......@@ -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. */
bzero(cached_charset, sizeof(cached_charset));
......@@ -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,
sizeof(cached_charset)))
......@@ -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)
{
clear_flag(IN_STMT);
......@@ -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)
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);
/*
......@@ -1156,7 +1156,7 @@ void st_relay_log_info::cleanup_context(THD *thd, bool error)
DBUG_VOID_RETURN;
}
void st_relay_log_info::clear_tables_to_lock()
void Relay_log_info::clear_tables_to_lock()
{
while (tables_to_lock)
{
......
......@@ -27,16 +27,16 @@ struct RPL_TABLE_LIST;
Replication SQL Thread
st_relay_log_info contains:
Relay_log_info contains:
- the current relay log
- the current relay log offset
- master log name
- master log sequence corresponding to the last update
- misc information specific to the SQL thread
st_relay_log_info is initialized from the slave.info file if such exists.
Otherwise, data members are intialized with defaults. The initialization is
done with init_relay_log_info() call.
Relay_log_info is initialized from the slave.info file if such
exists. Otherwise, data members are intialized with defaults. The
initialization is done with init_relay_log_info() call.
The format of slave.info file:
......@@ -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.
*/
......@@ -120,8 +121,8 @@ typedef struct st_relay_log_info : public Slave_reporting_capability
*/
pthread_cond_t start_cond, stop_cond, data_cond;
/* parent MASTER_INFO structure */
class MASTER_INFO *mi;
/* parent Master_info structure */
Master_info *mi;
/*
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
char ign_master_log_name_end[FN_REFLEN];
ulonglong ign_master_log_pos_end;
st_relay_log_info();
~st_relay_log_info();
Relay_log_info();
~Relay_log_info();
/*
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
private:
uint32 m_flags;
} RELAY_LOG_INFO;
};
// 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 */
......@@ -164,7 +164,7 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data)
*/
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
{
/*
......@@ -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());
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;
......
......@@ -22,8 +22,7 @@
#include "mysql_priv.h"
struct st_relay_log_info;
typedef st_relay_log_info RELAY_LOG_INFO;
class Relay_log_info;
/**
......@@ -237,7 +236,7 @@ class table_def
@retval 1 if the table definition is not 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:
ulong m_size; // Number of elements in the types array
......
This diff is collapsed.
......@@ -29,10 +29,9 @@
// Forward declarations
struct st_relay_log_info;
typedef st_relay_log_info RELAY_LOG_INFO;
class Relay_log_info;
class Master_info;
class MASTER_INFO;
/*****************************************************************************
......@@ -43,11 +42,11 @@ class MASTER_INFO;
I/O Thread - One of these threads is started for each master server.
They maintain a connection to their master server, read log
events from the master as they arrive, and queues them into
a single, shared relay log file. A MASTER_INFO
a single, shared relay log file. A Master_info
represents each of these threads.
SQL Thread - One of these threads is started and reads from the relay log
file, executing each event. A RELAY_LOG_INFO
file, executing each event. A Relay_log_info
represents this thread.
Buffering in the relay log file makes it unnecessary to reread events from
......@@ -70,18 +69,18 @@ class MASTER_INFO;
mi->run_lock, keeps rli->run_lock, and tries to re-acquire mi->run_lock).
Currently active_mi never moves (it's created at startup and deleted at
shutdown, and not changed: it always points to the same MASTER_INFO struct),
shutdown, and not changed: it always points to the same Master_info struct),
because we don't have multimaster. So for the moment, mi does not move, and
mi->rli does not either.
In MASTER_INFO: run_lock, data_lock
In Master_info: run_lock, data_lock
run_lock protects all information about the run state: slave_running, and the
existence of the I/O thread (to stop/start it, you need this mutex).
data_lock protects some moving members of the struct: counters (log name,
position) and relay log (MYSQL_BIN_LOG object).
In RELAY_LOG_INFO: run_lock, data_lock
see MASTER_INFO
In Relay_log_info: run_lock, data_lock
see Master_info
Order of acquisition: if you want to have LOCK_active_mi and a run_lock, you
must acquire LOCK_active_mi first.
......@@ -102,12 +101,12 @@ extern my_bool opt_log_slave_updates;
extern ulonglong relay_log_space_limit;
/*
3 possible values for MASTER_INFO::slave_running and
RELAY_LOG_INFO::slave_running.
3 possible values for Master_info::slave_running and
Relay_log_info::slave_running.
The values 0,1,2 are very important: to keep the diff small, I didn't
substitute places where we use 0/1 with the newly defined symbols. So don't change
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.
I started with using an enum, but
enum_variable=1; is not legal so would have required many line changes.
......@@ -129,16 +128,16 @@ extern ulonglong relay_log_space_limit;
int init_slave();
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 terminate_slave_threads(MASTER_INFO* mi, int thread_mask,
int terminate_slave_threads(Master_info* mi, int thread_mask,
bool skip_lock = 0);
int terminate_slave_thread(THD* thd, pthread_mutex_t* term_mutex,
pthread_mutex_t* cond_lock,
pthread_cond_t* term_cond,
volatile uint* slave_running);
int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
MASTER_INFO* mi, const char* master_info_fname,
Master_info* mi, const char* master_info_fname,
const char* slave_info_fname, int thread_mask);
/*
cond_lock is usually same as start_lock. It is needed for the case when
......@@ -151,7 +150,7 @@ int start_slave_thread(pthread_handler h_func, pthread_mutex_t* start_lock,
pthread_cond_t* start_cond,
volatile uint *slave_running,
volatile ulong *slave_run_id,
MASTER_INFO* mi,
Master_info* mi,
bool high_priority);
/* If fd is -1, dump to NET */
......@@ -160,37 +159,37 @@ int mysql_table_dump(THD* thd, const char* db,
/* retrieve table from master and copy to slave*/
int fetch_master_table(THD* thd, const char* db_name, const char* table_name,
MASTER_INFO* mi, MYSQL* mysql, bool overwrite);
Master_info* mi, MYSQL* mysql, bool overwrite);
bool show_master_info(THD* thd, MASTER_INFO* mi);
bool show_master_info(THD* thd, Master_info* mi);
bool show_binlog_info(THD* thd);
bool rpl_master_has_bug(RELAY_LOG_INFO *rli, uint bug_id);
bool rpl_master_has_bug(Relay_log_info *rli, uint bug_id);
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 end_slave(); /* clean up */
void clear_until_condition(RELAY_LOG_INFO* rli);
void clear_slave_error(RELAY_LOG_INFO* rli);
void end_relay_log_info(RELAY_LOG_INFO* rli);
void lock_slave_threads(MASTER_INFO* mi);
void unlock_slave_threads(MASTER_INFO* mi);
void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse);
int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,ulonglong pos,
void clear_until_condition(Relay_log_info* rli);
void clear_slave_error(Relay_log_info* rli);
void end_relay_log_info(Relay_log_info* rli);
void lock_slave_threads(Master_info* mi);
void unlock_slave_threads(Master_info* mi);
void init_thread_mask(int* mask,Master_info* mi,bool inverse);
int init_relay_log_pos(Relay_log_info* rli,const char* log,ulonglong pos,
bool need_data_lock, const char** errmsg,
bool look_for_description_event);
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);
void set_slave_thread_options(THD* thd);
void set_slave_thread_default_charset(THD *thd, RELAY_LOG_INFO const *rli);
void rotate_relay_log(MASTER_INFO* mi);
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli);
void rotate_relay_log(Master_info* mi);
pthread_handler_t handle_slave_io(void *arg);
pthread_handler_t handle_slave_sql(void *arg);
extern bool volatile abort_loop;
extern MASTER_INFO main_mi, *active_mi; /* active_mi for multi-master */
extern Master_info main_mi, *active_mi; /* active_mi for multi-master */
extern LIST master_list;
extern my_bool replicate_same_server_id;
......
......@@ -52,7 +52,7 @@ void mysql_client_binlog_statement(THD* thd)
Allocation
*/
if (!thd->rli_fake)
thd->rli_fake= new RELAY_LOG_INFO;
thd->rli_fake= new Relay_log_info;
const Format_description_log_event *desc=
new Format_description_log_event(4);
......
......@@ -23,8 +23,7 @@
#include "log.h"
#include "rpl_tblmap.h"
struct st_relay_log_info;
typedef st_relay_log_info RELAY_LOG_INFO;
class Relay_log_info;
class Query_log_event;
class Load_log_event;
......@@ -970,7 +969,7 @@ class THD :public Statement,
{
public:
/* 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.
......
......@@ -762,7 +762,7 @@ impossible position";
DBUG_VOID_RETURN;
}
int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
int start_slave(THD* thd , Master_info* mi, bool net_report)
{
int slave_errno= 0;
int thread_mask;
......@@ -799,7 +799,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
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;
/*
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)
}
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;
strmake(mi->rli.until_log_name, thd->lex->mi.relay_log_name,
sizeof(mi->rli.until_log_name)-1);
......@@ -818,7 +818,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
else
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 */
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)
/* mark the cached result of the UNTIL comparison as "undefined" */
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 */
if (!opt_skip_slave_start)
......@@ -887,7 +887,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
}
int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
int stop_slave(THD* thd, Master_info* mi, bool net_report )
{
DBUG_ENTER("stop_slave");
......@@ -953,7 +953,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
*/
int reset_slave(THD *thd, MASTER_INFO* mi)
int reset_slave(THD *thd, Master_info* mi)
{
MY_STAT stat_area;
char fname[FN_REFLEN];
......@@ -1067,7 +1067,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
}
bool change_master(THD* thd, MASTER_INFO* mi)
bool change_master(THD* thd, Master_info* mi)
{
int thread_mask;
const char* errmsg= 0;
......
......@@ -42,20 +42,20 @@ extern my_bool opt_sporadic_binlog_dump_fail;
pthread_mutex_unlock(&(thd)->LOCK_delete); \
} while(0)
int start_slave(THD* thd, MASTER_INFO* mi, bool net_report);
int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report);
bool change_master(THD* thd, MASTER_INFO* mi);
int start_slave(THD* thd, Master_info* mi, bool net_report);
int stop_slave(THD* thd, Master_info* mi, bool net_report);
bool change_master(THD* thd, Master_info* mi);
bool mysql_show_binlog_events(THD* thd);
int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
const char* log_file_name2, ulonglong log_pos2);
int reset_slave(THD *thd, MASTER_INFO* mi);
int reset_slave(THD *thd, Master_info* mi);
int reset_master(THD* thd);
bool purge_master_logs(THD* thd, const char* to_log);
bool purge_master_logs_before_date(THD* thd, time_t purge_time);
bool log_in_use(const char* log_name);
void adjust_linfo_offsets(my_off_t purge_offset);
bool show_binlogs(THD* thd);
extern int init_master_info(MASTER_INFO* mi);
extern int init_master_info(Master_info* mi);
void kill_zombie_dump_threads(uint32 slave_server_id);
int check_binlog_magic(IO_CACHE* log, const char** errmsg);
......
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