1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Refactoring: Moved rli code to new file rpl_rli.cc. The idea being that rli

should be a separate module (i.e. a class) to make it easier to maintain the 
code, e.g. by having checks within the rli checking sanity of data and making 
member variables private.  This will also ease implementation of multi-source 
and, at least in my fantasies :), make it possible in some future to have 
separate replication servers.


sql/Makefile.am:
  Added file rpl_rli.cc
sql/repl_failsafe.cc:
  Move function
sql/rpl_rli.h:
  moved functions
sql/slave.cc:
  Moved rli code into rpl_rli.cc
sql/sql_repl.cc:
  Changed function to be member function
sql/rpl_rli.cc:
  Code for rli
This commit is contained in:
unknown
2006-10-31 12:23:14 +01:00
parent b7d43470be
commit 69d92fb189
6 changed files with 1207 additions and 1161 deletions

View File

@@ -93,7 +93,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \ sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
slave.cc sql_repl.cc rpl_filter.cc rpl_tblmap.cc \ slave.cc sql_repl.cc rpl_filter.cc rpl_tblmap.cc \
rpl_utility.cc rpl_injector.cc \ rpl_utility.cc rpl_injector.cc rpl_rli.cc \
sql_union.cc sql_derived.cc \ sql_union.cc sql_derived.cc \
client.c sql_client.cc mini_client_errors.c pack.c\ client.c sql_client.cc mini_client_errors.c pack.c\
stacktrace.c repl_failsafe.h repl_failsafe.cc \ stacktrace.c repl_failsafe.h repl_failsafe.cc \

View File

@@ -962,7 +962,7 @@ bool load_master_data(THD* thd)
Cancel the previous START SLAVE UNTIL, as the fact to download Cancel the previous START SLAVE UNTIL, as the fact to download
a new copy logically makes UNTIL irrelevant. a new copy logically makes UNTIL irrelevant.
*/ */
clear_until_condition(&active_mi->rli); active_mi->rli.clear_until_condition();
/* /*
No need to update rli.event* coordinates, they will be when the slave No need to update rli.event* coordinates, they will be when the slave

1187
sql/rpl_rli.cc Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@
#include "rpl_tblmap.h" #include "rpl_tblmap.h"
/**************************************************************************** /****************************************************************************
Replication SQL Thread Replication SQL Thread
@@ -164,6 +165,9 @@ typedef struct st_relay_log_info
time_t last_master_timestamp; time_t last_master_timestamp;
void clear_slave_error();
void clear_until_condition();
/* /*
Needed for problems when slave stops and we want to restart it Needed for problems when slave stops and we want to restart it
skipping one or more events in the master log that have caused skipping one or more events in the master log that have caused
@@ -322,4 +326,9 @@ typedef struct st_relay_log_info
time_t unsafe_to_stop_at; time_t unsafe_to_stop_at;
} RELAY_LOG_INFO; } RELAY_LOG_INFO;
// Defined in rpl_rli.cc
int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname);
#endif /* RPL_RLI_H */ #endif /* RPL_RLI_H */

File diff suppressed because it is too large Load Diff

View File

@@ -805,7 +805,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
sizeof(mi->rli.until_log_name)-1); sizeof(mi->rli.until_log_name)-1);
} }
else else
clear_until_condition(&mi->rli); 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)
{ {
@@ -978,8 +978,8 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
Reset errors (the idea is that we forget about the Reset errors (the idea is that we forget about the
old master). old master).
*/ */
clear_slave_error(&mi->rli); mi->rli.clear_slave_error();
clear_until_condition(&mi->rli); mi->rli.clear_until_condition();
// close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0 // close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
end_master_info(mi); end_master_info(mi);
@@ -1244,8 +1244,8 @@ bool change_master(THD* thd, MASTER_INFO* mi)
pthread_mutex_lock(&mi->rli.data_lock); pthread_mutex_lock(&mi->rli.data_lock);
mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */ mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */
/* Clear the errors, for a clean start */ /* Clear the errors, for a clean start */
clear_slave_error(&mi->rli); mi->rli.clear_slave_error();
clear_until_condition(&mi->rli); mi->rli.clear_until_condition();
/* /*
If we don't write new coordinates to disk now, then old will remain in If we don't write new coordinates to disk now, then old will remain in
relay-log.info until START SLAVE is issued; but if mysqld is shutdown relay-log.info until START SLAVE is issued; but if mysqld is shutdown