Skip to content

Commit 36ea48b

Browse files
Merge branch 'mysql-5.7' into mysql-8.0
2 parents eb57577 + d73f98b commit 36ea48b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

sql/rpl_context.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ bool Session_consistency_gtids_ctx::notify_after_gtid_executed_update(
132132
return res;
133133
}
134134

135+
void Session_consistency_gtids_ctx::
136+
update_tracking_activeness_from_session_variable(const THD *thd) {
137+
m_curr_session_track_gtids = thd->variables.session_track_gtids;
138+
}
139+
135140
bool Session_consistency_gtids_ctx::notify_after_response_packet(
136141
const THD *thd) {
137142
int res = false;
@@ -144,7 +149,7 @@ bool Session_consistency_gtids_ctx::notify_after_response_packet(
144149
this value. It may have changed (the previous command may have been
145150
a SET SESSION session_track_gtids=...;).
146151
*/
147-
m_curr_session_track_gtids = thd->variables.session_track_gtids;
152+
update_tracking_activeness_from_session_variable(thd);
148153
return res;
149154
}
150155

@@ -162,7 +167,7 @@ void Session_consistency_gtids_ctx::register_ctx_change_listener(
162167
if the session_track_gtids value is set at startup time to anything
163168
different than OFF.
164169
*/
165-
m_curr_session_track_gtids = thd->variables.session_track_gtids;
170+
update_tracking_activeness_from_session_variable(thd);
166171
}
167172
}
168173

sql/rpl_context.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ class Session_consistency_gtids_ctx {
201201
return notify_after_transaction_commit(thd);
202202
}
203203

204+
/**
205+
Update session tracker (m_curr_session_track_gtids) from thd.
206+
*/
207+
void update_tracking_activeness_from_session_variable(const THD *thd);
208+
204209
private:
205210
// not implemented
206211
Session_consistency_gtids_ctx(const Session_consistency_gtids_ctx &rsc);

sql/rpl_slave.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,6 +3815,11 @@ void set_slave_thread_options(THD *thd) {
38153815
thd->variables.option_bits = options;
38163816
thd->variables.completion_type = 0;
38173817

3818+
/* Do not track GTIDs for slave threads to avoid performance issues. */
3819+
thd->variables.session_track_gtids = OFF;
3820+
thd->rpl_thd_ctx.session_gtids_ctx()
3821+
.update_tracking_activeness_from_session_variable(thd);
3822+
38183823
/*
38193824
Set autocommit= 1 when info tables are used and autocommit == 0 to
38203825
avoid trigger asserts on mysql_execute_command(THD *thd) caused by

0 commit comments

Comments
 (0)