[Commits] 1ce8a497c5c: postreview change
revision-id: 1ce8a497c5c0c1d30a6602c8650bc604d8074baa (mariadb-10.2.15-71-g1ce8a497c5c) parent(s): 36f7324255f03bd812444016acb418d6a0abec74 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2018-06-19 18:24:22 +0200 message: postreview change --- sql/log.cc | 12 ++---------- sql/sql_class.cc | 13 ++++++++++++- sql/sql_class.h | 8 +++++++- sql/sys_vars.cc | 5 +++-- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index d0e1c8ca523..d83f2e1930c 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -5947,16 +5947,8 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone, } if (err) DBUG_RETURN(true); - bool changed_gtid= (thd->last_commit_gtid.seq_no != gtid.seq_no); - thd->last_commit_gtid= gtid; - if (changed_gtid && - thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->is_enabled()) - { - mysql_mutex_lock(&LOCK_plugin); - thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)-> - mark_as_changed(thd, (LEX_CSTRING*)Sys_last_gtid_ptr); - mysql_mutex_unlock(&LOCK_plugin); - } + + thd->set_last_commit_gtid(gtid); Gtid_log_event gtid_event(thd, seq_no, domain_id, standalone, LOG_EVENT_SUPPRESS_USE_F, is_transactional, diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 7e15eff4dd4..d2959b0dac5 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1287,7 +1287,7 @@ void THD::init(void) bzero((char *) &org_status_var, sizeof(org_status_var)); status_in_global= 0; start_bytes_received= 0; - last_commit_gtid.seq_no= 0; + m_last_commit_gtid.seq_no= 0; last_stmt= NULL; /* Reset status of last insert id */ arg_of_last_insert_id_function= FALSE; @@ -7069,6 +7069,17 @@ THD::signal_wakeup_ready() mysql_cond_signal(&COND_wakeup_ready); } +void THD::set_last_commit_gtid(rpl_gtid >id) +{ + bool changed_gtid= (m_last_commit_gtid.seq_no != gtid.seq_no); + m_last_commit_gtid= gtid; + if (changed_gtid && + session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->is_enabled()) + { + session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)-> + mark_as_changed(this, (LEX_CSTRING*)Sys_last_gtid_ptr); + } +} void wait_for_commit::reinit() diff --git a/sql/sql_class.h b/sql/sql_class.h index a12015ecfe4..024ec3b4017 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4254,7 +4254,13 @@ class THD :public Statement, The GTID assigned to the last commit. If no GTID was assigned to any commit so far, this is indicated by last_commit_gtid.seq_no == 0. */ - rpl_gtid last_commit_gtid; +private: + rpl_gtid m_last_commit_gtid; + +public: + rpl_gtid get_last_commit_gtid() { return m_last_commit_gtid; } + void set_last_commit_gtid(rpl_gtid >id); + LF_PINS *tdc_hash_pins; LF_PINS *xid_hash_pins; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index f2665b01dd6..2af4a0922be 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1846,8 +1846,9 @@ Sys_var_last_gtid::session_value_ptr(THD *thd, const LEX_STRING *base) bool first= true; str.length(0); - if ((thd->last_commit_gtid.seq_no > 0 && - rpl_slave_state_tostring_helper(&str, &thd->last_commit_gtid, &first)) || + rpl_gtid gtid= thd->get_last_commit_gtid(); + if ((gtid.seq_no > 0 && + rpl_slave_state_tostring_helper(&str, >id, &first)) || !(p= thd->strmake(str.ptr(), str.length()))) { my_error(ER_OUT_OF_RESOURCES, MYF(0));
participants (1)
-
Oleksandr Byelkin