Skip to content

Commit 3b86e51

Browse files
Merge branch 'mysql-8.0' into mysql-trunk
2 parents 855443d + 36ea48b commit 3b86e51

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
@@ -133,6 +133,11 @@ bool Session_consistency_gtids_ctx::notify_after_gtid_executed_update(
133133
return res;
134134
}
135135

136+
void Session_consistency_gtids_ctx::
137+
update_tracking_activeness_from_session_variable(const THD *thd) {
138+
m_curr_session_track_gtids = thd->variables.session_track_gtids;
139+
}
140+
136141
bool Session_consistency_gtids_ctx::notify_after_response_packet(
137142
const THD *thd) {
138143
int res = false;
@@ -145,7 +150,7 @@ bool Session_consistency_gtids_ctx::notify_after_response_packet(
145150
this value. It may have changed (the previous command may have been
146151
a SET SESSION session_track_gtids=...;).
147152
*/
148-
m_curr_session_track_gtids = thd->variables.session_track_gtids;
153+
update_tracking_activeness_from_session_variable(thd);
149154
return res;
150155
}
151156

@@ -163,7 +168,7 @@ void Session_consistency_gtids_ctx::register_ctx_change_listener(
163168
if the session_track_gtids value is set at startup time to anything
164169
different than OFF.
165170
*/
166-
m_curr_session_track_gtids = thd->variables.session_track_gtids;
171+
update_tracking_activeness_from_session_variable(thd);
167172
}
168173
}
169174

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)