Commit 14ea63cd authored by unknown's avatar unknown

Replication: simplification of init_relay_log_pos: always initialize,

remove variable rli->log_pos_current.


sql/slave.cc:
  Simplification of init_relay_log_pos : always initialize,
  remove variable rli->log_pos_current.
sql/slave.h:
  Simplification of init_relay_log_pos : always initialize,
  remove variable rli->log_pos_current.
parent f29fb98d
...@@ -210,8 +210,6 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log, ...@@ -210,8 +210,6 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
DBUG_ENTER("init_relay_log_pos"); DBUG_ENTER("init_relay_log_pos");
*errmsg=0; *errmsg=0;
if (rli->log_pos_current) // TODO: When can this happen ?
DBUG_RETURN(0);
pthread_mutex_t *log_lock=rli->relay_log.get_log_lock(); pthread_mutex_t *log_lock=rli->relay_log.get_log_lock();
pthread_mutex_lock(log_lock); pthread_mutex_lock(log_lock);
if (need_data_lock) if (need_data_lock)
...@@ -273,7 +271,6 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log, ...@@ -273,7 +271,6 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
} }
if (pos > BIN_LOG_HEADER_SIZE) if (pos > BIN_LOG_HEADER_SIZE)
my_b_seek(rli->cur_log,(off_t)pos); my_b_seek(rli->cur_log,(off_t)pos);
rli->log_pos_current=1;
err: err:
pthread_cond_broadcast(&rli->data_cond); pthread_cond_broadcast(&rli->data_cond);
...@@ -349,7 +346,6 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset, ...@@ -349,7 +346,6 @@ int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset,
rli->log_space_total= BIN_LOG_HEADER_SIZE; rli->log_space_total= BIN_LOG_HEADER_SIZE;
rli->relay_log_pos= BIN_LOG_HEADER_SIZE; rli->relay_log_pos= BIN_LOG_HEADER_SIZE;
rli->relay_log.reset_bytes_written(); rli->relay_log.reset_bytes_written();
rli->log_pos_current=0;
if (!just_reset) if (!just_reset)
error= init_relay_log_pos(rli, rli->relay_log_name, rli->relay_log_pos, error= init_relay_log_pos(rli, rli->relay_log_name, rli->relay_log_pos,
0 /* do not need data lock */, errmsg); 0 /* do not need data lock */, errmsg);
...@@ -1153,7 +1149,6 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname) ...@@ -1153,7 +1149,6 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname)
rli->pending = 0; rli->pending = 0;
rli->cur_log_fd = -1; rli->cur_log_fd = -1;
rli->slave_skip_counter=0; rli->slave_skip_counter=0;
rli->log_pos_current=0;
rli->abort_pos_wait=0; rli->abort_pos_wait=0;
rli->skip_log_purge=0; rli->skip_log_purge=0;
rli->log_space_limit = relay_log_space_limit; rli->log_space_limit = relay_log_space_limit;
...@@ -1581,7 +1576,7 @@ st_relay_log_info::st_relay_log_info() ...@@ -1581,7 +1576,7 @@ st_relay_log_info::st_relay_log_info()
cur_log_old_open_count(0), log_space_total(0), cur_log_old_open_count(0), log_space_total(0),
slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0), slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0),
sql_thd(0), last_slave_errno(0), inited(0), abort_slave(0), sql_thd(0), last_slave_errno(0), inited(0), abort_slave(0),
slave_running(0), log_pos_current(0), skip_log_purge(0), slave_running(0), skip_log_purge(0),
inside_transaction(0) /* the default is autocommit=1 */ inside_transaction(0) /* the default is autocommit=1 */
{ {
relay_log_name[0] = master_log_name[0] = 0; relay_log_name[0] = master_log_name[0] = 0;
...@@ -2459,7 +2454,6 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \ ...@@ -2459,7 +2454,6 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
TODO: see if we can do this conditionally in next_event() instead TODO: see if we can do this conditionally in next_event() instead
to avoid unneeded position re-init to avoid unneeded position re-init
*/ */
rli->log_pos_current=0;
thd->temporary_tables = 0; // remove tempation from destructor to close them thd->temporary_tables = 0; // remove tempation from destructor to close them
DBUG_ASSERT(thd->net.buff != 0); DBUG_ASSERT(thd->net.buff != 0);
net_end(&thd->net); // destructor will not free it, because we are weird net_end(&thd->net); // destructor will not free it, because we are weird
...@@ -2795,7 +2789,6 @@ void end_relay_log_info(RELAY_LOG_INFO* rli) ...@@ -2795,7 +2789,6 @@ void end_relay_log_info(RELAY_LOG_INFO* rli)
rli->cur_log_fd = -1; rli->cur_log_fd = -1;
} }
rli->inited = 0; rli->inited = 0;
rli->log_pos_current=0;
rli->relay_log.close(1); rli->relay_log.close(1);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -167,7 +167,6 @@ typedef struct st_relay_log_info ...@@ -167,7 +167,6 @@ typedef struct st_relay_log_info
/* if not set, the value of other members of the structure are undefined */ /* if not set, the value of other members of the structure are undefined */
bool inited; bool inited;
volatile bool abort_slave, slave_running; volatile bool abort_slave, slave_running;
bool log_pos_current;
bool skip_log_purge; bool skip_log_purge;
bool inside_transaction; bool inside_transaction;
......
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