Skip to content

Commit

Permalink
Small fix to setting trans markers in new_file_impl()
Browse files Browse the repository at this point in the history
Summary:
`current_thd` can be NULL during init. We should check for
this.

Reviewed By: bhatvinay

Differential Revision: D24900223

fbshipit-source-id: d6ff5923620
  • Loading branch information
abhinav04sharma authored and facebook-github-bot committed Mar 13, 2021
1 parent 4cd2cff commit 9486d32
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sql/binlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7190,11 +7190,14 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock_log,
update_binlog_end_pos();

// Let's stash the new file and pos in THD
get_current_log_without_lock_log(&info);
if (mysql_bin_log.is_apply_log)
current_thd->set_trans_relay_log_pos(info.log_file_name, info.pos);
else
current_thd->set_trans_pos(info.log_file_name, info.pos, nullptr);
if (enable_raft_plugin && current_thd)
{
get_current_log_without_lock_log(&info);
if (mysql_bin_log.is_apply_log)
current_thd->set_trans_relay_log_pos(info.log_file_name, info.pos);
else
current_thd->set_trans_pos(info.log_file_name, info.pos, nullptr);
}


old_name=name;
Expand Down

0 comments on commit 9486d32

Please sign in to comment.