Skip to content
/ server Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sql/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3550,7 +3550,9 @@ MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period)
is_relay_log(0), relay_signal_cnt(0),
checksum_alg_reset(BINLOG_CHECKSUM_ALG_UNDEF),
relay_log_checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF),
description_event_for_exec(0), description_event_for_queue(0),
description_event_for_sql_thread

(0), description_event_for_queue(0),
current_binlog_id(0), reset_master_count(0)
{
/*
Expand Down Expand Up @@ -3598,7 +3600,9 @@ void MYSQL_BIN_LOG::cleanup()
close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT);
mysql_mutex_unlock(&LOCK_log);
delete description_event_for_queue;
delete description_event_for_exec;
delete description_event_for_sql_thread

;

while ((b= binlog_xid_count_list.get()))
{
Expand Down
3 changes: 2 additions & 1 deletion sql/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,8 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
the case of a master which has been upgraded from 5.0 to 5.1 without doing
RESET MASTER, or from 4.x to 5.0).
*/
Format_description_log_event *description_event_for_exec,
Format_description_log_event *description_event_for_sql_thread
,
*description_event_for_queue;
/*
Binlog position of last commit (or non-transactional write) to the binlog.
Expand Down
28 changes: 21 additions & 7 deletions sql/log_event_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,9 @@ int Start_log_event_v3::do_apply_event(rpl_group_info *rgi)
thread.
*/
case 1:
if (strncmp(rli->relay_log.description_event_for_exec->server_version,
if (strncmp(rli->relay_log.description_event_for_sql_thread

->server_version,
"3.23.57",7) >= 0 && created)
{
/*
Expand Down Expand Up @@ -2474,9 +2476,15 @@ int Format_description_log_event::do_apply_event(rpl_group_info *rgi)
if (!ret)
{
/* Save the information describing this binlog */
copy_crypto_data(rli->relay_log.description_event_for_exec);
delete rli->relay_log.description_event_for_exec;
rli->relay_log.description_event_for_exec= this;
copy_crypto_data(rli->relay_log.description_event_for_sql_thread

);
delete rli->relay_log.description_event_for_sql_thread

;
rli->relay_log.description_event_for_sql_thread

= this;
}

DBUG_RETURN(ret);
Expand Down Expand Up @@ -2520,7 +2528,9 @@ Format_description_log_event::do_shall_skip(rpl_group_info *rgi)
#if defined(HAVE_REPLICATION)
int Start_encryption_log_event::do_apply_event(rpl_group_info* rgi)
{
return rgi->rli->relay_log.description_event_for_exec->start_decryption(this);
return rgi->rli->relay_log.description_event_for_sql_thread

->start_decryption(this);
}

int Start_encryption_log_event::do_update_pos(rpl_group_info *rgi)
Expand Down Expand Up @@ -3216,7 +3226,9 @@ int Rotate_log_event::do_update_pos(rpl_group_info *rgi)
/*
Reset thd->variables.option_bits and sql_mode etc, because this could
be the signal of a master's downgrade from 5.0 to 4.0.
However, no need to reset description_event_for_exec: indeed, if the next
However, no need to reset description_event_for_sql_thread
: indeed, if the next
master is 5.0 (even 5.0.1) we will soon get a Format_desc; if the next
master is 4.0 then the events are in the slave's format (conversion).
*/
Expand Down Expand Up @@ -5064,7 +5076,9 @@ int Execute_load_log_event::do_apply_event(rpl_group_info *rgi)
}
if (!(lev= (Load_log_event*)
Log_event::read_log_event(&file, &read_error,
rli->relay_log.description_event_for_exec,
rli->relay_log.description_event_for_sql_thread

,
opt_slave_sql_verify_checksum)) ||
lev->get_type_code() != NEW_LOAD_EVENT)
{
Expand Down
20 changes: 15 additions & 5 deletions sql/rpl_rli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -664,14 +664,18 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log,
the description_event here, in case, so that there is no memory leak in
running, say, CHANGE MASTER.
*/
delete rli->relay_log.description_event_for_exec;
delete rli->relay_log.description_event_for_sql_thread

;
/*
By default the relay log is in binlog format 3 (4.0).
Even if format is 4, this will work enough to read the first event
(Format_desc) (remember that format 4 is just lenghtened compared to format
3; format 3 is a prefix of format 4).
*/
rli->relay_log.description_event_for_exec= new
rli->relay_log.description_event_for_sql_thread

= new
Format_description_log_event(3);

mysql_mutex_lock(log_lock);
Expand Down Expand Up @@ -738,8 +742,12 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log,
Format_description_log_event *fdev;
if (!(fdev= read_relay_log_description_event(rli->cur_log, pos, errmsg)))
goto err;
delete rli->relay_log.description_event_for_exec;
rli->relay_log.description_event_for_exec= fdev;
delete rli->relay_log.description_event_for_sql_thread

;
rli->relay_log.description_event_for_sql_thread

= fdev;
}
my_b_seek(rli->cur_log,(off_t)pos);
DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%llu rli->event_relay_log_pos=%llu",
Expand All @@ -760,7 +768,9 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log,

if (need_data_lock)
mysql_mutex_unlock(&rli->data_lock);
if (!rli->relay_log.description_event_for_exec->is_valid() && !*errmsg)
if (!rli->relay_log.description_event_for_sql_thread

->is_valid() && !*errmsg)
*errmsg= "Invalid Format_description log event; could be out of memory";

DBUG_PRINT("info", ("Returning %d from init_relay_log_pos", (*errmsg)?1:0));
Expand Down
24 changes: 18 additions & 6 deletions sql/slave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5893,8 +5893,12 @@ pthread_handler_t handle_slave_sql(void *arg)
/* When master_pos_wait() wakes up it will check this and terminate */
rli->slave_running= MYSQL_SLAVE_NOT_RUN;
/* Forget the relay log's format */
delete rli->relay_log.description_event_for_exec;
rli->relay_log.description_event_for_exec= 0;
delete rli->relay_log.description_event_for_sql_thread

;
rli->relay_log.description_event_for_sql_thread

= 0;
rli->reset_inuse_relaylog();
/* Wake up master_pos_wait() */
DBUG_PRINT("info",("Signaling possibly waiting master_pos_wait() functions"));
Expand Down Expand Up @@ -7849,7 +7853,9 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
old_pos= rli->event_relay_log_pos;
int error;
if ((ev= Log_event::read_log_event(cur_log, &error,
rli->relay_log.description_event_for_exec,
rli->relay_log.description_event_for_sql_thread

,
opt_slave_sql_verify_checksum)))

{
Expand Down Expand Up @@ -8037,7 +8043,9 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
mysql_file_close(rli->cur_log_fd, MYF(MY_WME));
rli->cur_log_fd = -1;
rli->last_inuse_relaylog->completed= true;
rli->relay_log.description_event_for_exec->reset_crypto();
rli->relay_log.description_event_for_sql_thread

->reset_crypto();

if (relay_log_purge)
{
Expand Down Expand Up @@ -8365,7 +8373,9 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
{29621, { 10, 11,1 }, { 10, 11,3 } },
};
const Version &master_ver=
rli->relay_log.description_event_for_exec->server_version_split;
rli->relay_log.description_event_for_sql_thread

->server_version_split;
struct st_version_range_for_one_bug* versions_for_all_bugs= maria_master ?
versions_for_our_bugs : versions_for_their_bugs;
uint all_size= maria_master ?
Expand Down Expand Up @@ -8408,7 +8418,9 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
" that master be upgraded to a version at least"
" equal to '%d.%d.%d'. Then replication can be"
" restarted.",
rli->relay_log.description_event_for_exec->server_version,
rli->relay_log.description_event_for_sql_thread

->server_version,
bug_source,
bug_id,
fixed_in[0], fixed_in[1], fixed_in[2]);
Expand Down
16 changes: 12 additions & 4 deletions sql/sql_binlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
static int check_event_type(int type, Relay_log_info *rli)
{
Format_description_log_event *fd_event=
rli->relay_log.description_event_for_exec;
rli->relay_log.description_event_for_sql_thread

;

/*
Convert event type id of certain old versions (see comment in
Expand All @@ -60,7 +62,9 @@ static int check_event_type(int type, Relay_log_info *rli)
if we don't already have one.
*/
if (!fd_event)
if (!(rli->relay_log.description_event_for_exec=
if (!(rli->relay_log.description_event_for_sql_thread

=
new Format_description_log_event(4)))
{
my_error(ER_OUTOFMEMORY, MYF(0), 1);
Expand Down Expand Up @@ -176,7 +180,9 @@ int binlog_defragment(THD *thd)
BINLOG statement seen must be a base64 encoding of the
Format_description_log_event, as outputted by mysqlbinlog. This
Format_description_log_event is cached in
rli->description_event_for_exec.
rli->description_event_for_sql_thread
.
@param thd Pointer to THD object for the client thread executing the
statement.
Expand Down Expand Up @@ -319,7 +325,9 @@ void mysql_client_binlog_statement(THD* thd)
goto end;

ev= Log_event::read_log_event(bufptr, event_len, &error,
rli->relay_log.description_event_for_exec,
rli->relay_log.description_event_for_sql_thread

,
0);

DBUG_PRINT("info",("binlog base64 err=%s", error));
Expand Down
4 changes: 3 additions & 1 deletion sql/wsrep_applier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ wsrep_get_apply_format(THD* thd)

DBUG_ASSERT(thd->wsrep_rgi);

return thd->wsrep_rgi->rli->relay_log.description_event_for_exec;
return thd->wsrep_rgi->rli->relay_log.description_event_for_sql_thread

;
}

/* store error from rli */
Expand Down
8 changes: 6 additions & 2 deletions sql/wsrep_high_priority_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ static rpl_group_info* wsrep_relay_group_init(THD* thd, const char* log_fname)
{
Relay_log_info* rli= new Relay_log_info(false);

if (!rli->relay_log.description_event_for_exec)
if (!rli->relay_log.description_event_for_sql_thread

)
{
rli->relay_log.description_event_for_exec=
rli->relay_log.description_event_for_sql_thread

=
new Format_description_log_event(4);
}

Expand Down