Skip to content

Commit 08934ba

Browse files
author
Sven Sandberg
committed
BUG#31180464: THREADS MAY READ STALE VALUES OF GTID_MODE
Fix: Simplify gtid_mode implementation: - Encapsulate gtid_mode in a class, implement it in it its own .cc file, instead of in the header and in rpl_gtid_misc.cc. - Don't cache or version the value. - Use atomics, not locks, when reading the value. Extra: Minor improvements and refactorings: - Created Checkable_rwlock::Guard, a RAII class to hold a read or write lock for the duration of a block. Used it in only one file for now: rpl_group_replication.cc. Later we can use it to simplify more code. - Simplify prototypes for Gtid_state::begin_gtid_wait and get_server_startup_requirements: they don't need an argument to specify the lock type. - Make gtid_mode_lock be statically allocated rather than heap-allocated, to simplify memory management. - Don't use typelib in the enum-to-string helper functions. - Remove obsolete code in get_master_version_and_clock. We no longer allow masters with gtid_mode set to invalid values that begin with ON or OFF. This code was created in 5.6 which only had gtid_mode=ON|OFF, but we anticipated ON_PERMISSIVE|OFF_PERMISSIVE. - Remove obsolete comment in mysqld.cc. - Fix error message generated when failing to write Incident_log_event. If the query is long, it now cuts the query instead of the message. - Prefix members of Checkable_rwlock with m_. - In the error message generated for SET gtid_mode=ON_PERMISSIVE when replicate-same-server-id is enabled, explain the problem more precisely and don't repeat the gtid_mode twice. Background: In 5.7, gtid_mode is protected by 4 locks. A thread that sets it needs to hold all locks, and a thread that reads it needs to hold at least one of the locks. gtid_mode is only updated seldom, so it was not a problem to require many locks. Many places that read gtid_mode will already hold one of the locks for other reasons, so for those places the locking scheme was not a problem either. However, there were a couple of places where no lock was needed except in order to read gtid_mode. In 8.0 (WL#8599), we reduced locking in those places. To accomplish that, we introduced a global atomic integer which represents the version of gtid_mode. In addition, we introduced the class Gtid_mode_copy, which caches the global gtid_mode and its version number. When a caller requests gtid_mode from an instance of the class, the class first compares the cached version number with the global version number; if the cache is out of sync, it is refreshed; and finally it returns the cached value to the caller. Problem: Some cache objects are shared between multiple threads, but the members of the cache class are not protected against concurrent use. This can, at least theoretically, result in problems if threads T1 and T2 compete to read the same cache at about the same time, recently after some other thread has changed the global gtid_mode. If T1 comes first, it will update the cache with the most recent version number and gtid_mode. However, there is no guarantee that both those values are visible to T2. In the worst case, T2 may see the new version number and the old gtid_mode, thus it will get the wrong result. In addition, this scheme is over-complex. There is no need for versioning, caches, or locks; we should just make the global gtid_mode be an atomic. RB: 24259 Approved-by: Pedro Figueiredo <pedro.figueiredo@oracle.com> Approved-by: Pedro Gomes <pedro.gomes@oracle.com>
1 parent 3944a50 commit 08934ba

28 files changed

+499
-501
lines changed

include/mysql/group_replication_priv.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,8 @@ void set_auto_increment_offset(ulong auto_increment_offset);
120120
if one has conditions to proceed executing master-master replication.
121121
122122
@param[out] requirements requirements
123-
124-
@param[in] has_lock Caller should set this to true if the calling
125-
thread holds gtid_mode_lock; otherwise set it to false.
126123
*/
127-
void get_server_startup_prerequirements(Trans_context_info &requirements,
128-
bool has_lock);
124+
void get_server_startup_prerequirements(Trans_context_info &requirements);
129125

130126
/**
131127
Returns the server GTID_EXECUTED encoded as a binary string.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# restart: --log-error=MYSQLTEST_VARDIR/log/replicate_same_server_id.err --log-slave-updates --replicate-same-server-id --gtid-mode=ON --enforce-gtid-consistency
22
include/assert_grep.inc [Assert that the server starts and emits a warning]
33
SET @@global.gtid_mode=ON_PERMISSIVE;
4-
ERROR HY000: SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE is not allowed because replicate_same_server_id is set together with log_slave_updates and log_bin. Thus, setting @@global.GTID_MODE = ON_PERMISSIVE would lead to infinite loops in case this server is part of a circular replication topology.
4+
ERROR HY000: SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE is not allowed because replicate_same_server_id is set together with log_slave_updates and log_bin. Thus, any anonymous transactions would circulate infinitely in case this server is part of a circular replication topology.
55
# restart

mysql-test/suite/rpl_gtid/r/rpl_gtid_incident_event_cache_failure.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ SET GLOBAL binlog_stmt_cache_size = 4096;
3131
SET GLOBAL max_binlog_stmt_cache_size = 4096;
3232
# Adding debug point 'simulate_cache_creation_failure' to @@GLOBAL.debug
3333
SET GLOBAL binlog_error_action = ABORT_SERVER;
34-
ERROR HY000: Binary logging not possible. Message: Could not create IO cache while writing an incident event to the binary log for query: 'INSERT INTO t1 (c1, data)
35-
VALUES (2, CONCAT("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
34+
ERROR HY000: Binary logging not possible. Message: Could not create IO cache while writing an incident event to the binary log. Since GTID_MODE = ON, server is unable to proceed with logging. Query: 'INSERT INTO t1 (c1, data)
35+
VALUES (2, CONCAT("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3636
# Restart the master server
3737
include/rpl_reconnect.inc
3838
[connection master]

mysql-test/suite/rpl_nogtid/r/rpl_gtid_mode.result

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -375,19 +375,7 @@ START SLAVE IO_THREAD;
375375
include/wait_for_slave_io_error.inc [errno=13117]
376376
Last_IO_Error = 'The slave IO thread stops because the master has an unknown @@GLOBAL.GTID_MODE 'Krakel Spektakel'.'
377377
SET @@GLOBAL.DEBUG= @debug_saved;
378-
#
379-
# Warning generated if master has unknown gtid_mode that begins
380-
# with ON or OFF.
381-
#
382378
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
383-
SET @@GLOBAL.DEBUG = 'd,simulate_master_has_gtid_mode_on_something';
384-
include/start_slave.inc
385-
include/assert_grep.inc [Receiver thread should report that on_something is unknown]
386-
include/stop_slave.inc
387-
SET @@GLOBAL.DEBUG = 'd,simulate_master_has_gtid_mode_off_something';
388-
include/start_slave.inc
389-
include/assert_grep.inc [Receiver thread should report that off_something is unknown]
390-
include/stop_slave.inc
391379
RESET SLAVE;
392380
#
393381
# ER_CANT_SET_GTID_MODE generated because AUTO_POSITION = 1.

mysql-test/suite/rpl_nogtid/t/rpl_gtid_mode.test

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -665,30 +665,7 @@ START SLAVE IO_THREAD;
665665
--source include/wait_for_slave_io_error.inc
666666
SET @@GLOBAL.DEBUG= @debug_saved;
667667

668-
--echo #
669-
--echo # Warning generated if master has unknown gtid_mode that begins
670-
--echo # with ON or OFF.
671-
--echo #
672-
673668
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
674-
675-
SET @@GLOBAL.DEBUG = 'd,simulate_master_has_gtid_mode_on_something';
676-
--source include/start_slave.inc
677-
--let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.2.err
678-
--let $assert_count= 1
679-
--let $assert_only_after= Slave I/O thread for channel '': connected to master
680-
--let $assert_text= Receiver thread should report that on_something is unknown
681-
--let $assert_select= Slave I/O for channel '': The master uses an unknown GTID_MODE 'on_something'. Treating it as 'ON'.
682-
--source include/assert_grep.inc
683-
684-
--source include/stop_slave.inc
685-
SET @@GLOBAL.DEBUG = 'd,simulate_master_has_gtid_mode_off_something';
686-
--source include/start_slave.inc
687-
--let $assert_text= Receiver thread should report that off_something is unknown
688-
--let $assert_select= Slave I/O for channel '': The master uses an unknown GTID_MODE 'off_something'. Treating it as 'OFF'.
689-
--source include/assert_grep.inc
690-
691-
--source include/stop_slave.inc
692669
RESET SLAVE;
693670

694671
--echo #

plugin/group_replication/src/plugin.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,8 +2272,7 @@ static int check_if_server_properly_configured() {
22722272
// Struct that holds startup and runtime requirements
22732273
Trans_context_info startup_pre_reqs;
22742274

2275-
get_server_startup_prerequirements(startup_pre_reqs,
2276-
!lv.plugin_is_auto_starting_on_install);
2275+
get_server_startup_prerequirements(startup_pre_reqs);
22772276

22782277
if (!startup_pre_reqs.binlog_enabled) {
22792278
LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_BINLOG_DISABLED);
@@ -2285,7 +2284,7 @@ static int check_if_server_properly_configured() {
22852284
return 1;
22862285
}
22872286

2288-
if (startup_pre_reqs.gtid_mode != GTID_MODE_ON) {
2287+
if (startup_pre_reqs.gtid_mode != Gtid_mode::ON) {
22892288
LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_GTID_MODE_OFF);
22902289
return 1;
22912290
}

plugin/replication_observers_example/replication_observers_example.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ int validate_plugin_server_requirements(Trans_param *param) {
586586
get_server_parameters(&hostname, &port, &uuid, &server_version, &admin_port);
587587

588588
Trans_context_info startup_pre_reqs;
589-
get_server_startup_prerequirements(startup_pre_reqs, false);
589+
get_server_startup_prerequirements(startup_pre_reqs);
590590

591591
// check the server is initialized by checking if the default channel exists
592592
bool server_engine_ready = channel_is_active("", CHANNEL_NO_THD);

sql/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,7 @@ SET(BINLOG_SOURCE
873873
rpl_filter.cc
874874
rpl_gtid_execution.cc
875875
rpl_gtid_misc.cc
876+
rpl_gtid_mode.cc
876877
rpl_gtid_mutex_cond_array.cc
877878
rpl_gtid_owned.cc
878879
rpl_gtid_persist.cc

sql/binlog.cc

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7258,15 +7258,21 @@ bool MYSQL_BIN_LOG::write_incident(Incident_log_event *ev, THD *thd,
72587258
DBUG_EVALUATE_IF("simulate_cache_creation_failure", 1, 0)) {
72597259
if (thd->binlog_setup_trx_data() ||
72607260
DBUG_EVALUATE_IF("simulate_cache_creation_failure", 1, 0)) {
7261-
enum_gtid_mode gtid_mode = get_gtid_mode(GTID_MODE_LOCK_NONE);
7262-
if (gtid_mode == GTID_MODE_ON || gtid_mode == GTID_MODE_ON_PERMISSIVE) {
7263-
const char *mode = gtid_mode == GTID_MODE_ON ? "ON" : "ON_PERMISSIVE";
7261+
auto gtid_mode = global_gtid_mode.get();
7262+
if (gtid_mode == Gtid_mode::ON || gtid_mode == Gtid_mode::ON_PERMISSIVE) {
72647263
std::ostringstream message;
72657264

72667265
message << "Could not create IO cache while writing an incident event "
7267-
"to the binary log for query: '"
7268-
<< thd->query().str << "'. Since GTID_MODE= " << mode
7269-
<< ", server is unable to proceed with logging.";
7266+
"to the binary log. Since GTID_MODE = "
7267+
<< gtid_mode
7268+
<< ", server is unable to proceed with logging. Query: '";
7269+
/**
7270+
The reason for the error may be that the query was
7271+
huge. Better cut it to not run into resource problems.
7272+
*/
7273+
message.write(thd->query().str, MYSQL_ERRMSG_SIZE);
7274+
message << "'.";
7275+
72707276
handle_binlog_flush_or_sync_error(thd, true, message.str().c_str());
72717277
return true;
72727278
}
@@ -10492,11 +10498,11 @@ static bool handle_gtid_consistency_violation(THD *thd, int error_code,
1049210498
global_sid_lock->rdlock();
1049310499
enum_gtid_consistency_mode gtid_consistency_mode =
1049410500
get_gtid_consistency_mode();
10495-
enum_gtid_mode gtid_mode = get_gtid_mode(GTID_MODE_LOCK_SID);
10501+
auto gtid_mode = global_gtid_mode.get();
1049610502

1049710503
DBUG_PRINT("info", ("gtid_next.type=%d gtid_mode=%s "
1049810504
"gtid_consistency_mode=%d error=%d query=%s",
10499-
gtid_next_type, get_gtid_mode_string(gtid_mode),
10505+
gtid_next_type, Gtid_mode::to_string(gtid_mode),
1050010506
gtid_consistency_mode, error_code, thd->query().str));
1050110507

1050210508
/*
@@ -10508,7 +10514,7 @@ static bool handle_gtid_consistency_violation(THD *thd, int error_code,
1050810514
- ENFORCE_GTID_CONSISTENCY=ON.
1050910515
*/
1051010516
if ((gtid_next_type == AUTOMATIC_GTID &&
10511-
gtid_mode >= GTID_MODE_ON_PERMISSIVE) ||
10517+
gtid_mode >= Gtid_mode::ON_PERMISSIVE) ||
1051210518
gtid_next_type == ASSIGNED_GTID ||
1051310519
gtid_consistency_mode == GTID_CONSISTENCY_MODE_ON) {
1051410520
global_sid_lock->unlock();

sql/item_func.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4593,7 +4593,7 @@ longlong Item_wait_for_executed_gtid_set::val_int() {
45934593
Gtid_set wait_for_gtid_set(global_sid_map, nullptr);
45944594

45954595
global_sid_lock->rdlock();
4596-
if (get_gtid_mode(GTID_MODE_LOCK_SID) == GTID_MODE_OFF) {
4596+
if (global_gtid_mode.get() == Gtid_mode::OFF) {
45974597
global_sid_lock->unlock();
45984598
my_error(ER_GTID_MODE_OFF, MYF(0), "use WAIT_FOR_EXECUTED_GTID_SET");
45994599
null_value = true;
@@ -4619,7 +4619,7 @@ longlong Item_wait_for_executed_gtid_set::val_int() {
46194619
return 0;
46204620
}
46214621

4622-
gtid_state->begin_gtid_wait(GTID_MODE_LOCK_SID);
4622+
gtid_state->begin_gtid_wait();
46234623

46244624
double timeout = (arg_count == 2) ? args[1]->val_real() : 0;
46254625
if (timeout < 0) {
@@ -4721,12 +4721,12 @@ longlong Item_master_gtid_set_wait::val_int() {
47214721
mi = channel_map.get_default_channel_mi();
47224722
}
47234723

4724-
if (get_gtid_mode(GTID_MODE_LOCK_CHANNEL_MAP) == GTID_MODE_OFF) {
4724+
if (global_gtid_mode.get() == Gtid_mode::OFF) {
47254725
null_value = true;
47264726
channel_map.unlock();
47274727
return 0;
47284728
}
4729-
gtid_state->begin_gtid_wait(GTID_MODE_LOCK_CHANNEL_MAP);
4729+
gtid_state->begin_gtid_wait();
47304730

47314731
if (mi) mi->inc_reference();
47324732

sql/mysqld.cc

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ static PSI_mutex_key key_BINLOG_LOCK_sync;
11531153
static PSI_mutex_key key_BINLOG_LOCK_sync_queue;
11541154
static PSI_mutex_key key_BINLOG_LOCK_xids;
11551155
static PSI_rwlock_key key_rwlock_global_sid_lock;
1156-
static PSI_rwlock_key key_rwlock_gtid_mode_lock;
1156+
PSI_rwlock_key key_rwlock_gtid_mode_lock;
11571157
static PSI_rwlock_key key_rwlock_LOCK_system_variables_hash;
11581158
static PSI_rwlock_key key_rwlock_LOCK_sys_init_connect;
11591159
static PSI_rwlock_key key_rwlock_LOCK_sys_init_slave;
@@ -2461,10 +2461,6 @@ void gtid_server_cleanup() {
24612461
delete gtid_table_persistor;
24622462
gtid_table_persistor = nullptr;
24632463
}
2464-
if (gtid_mode_lock) {
2465-
delete gtid_mode_lock;
2466-
gtid_mode_lock = nullptr;
2467-
}
24682464
}
24692465

24702466
/**
@@ -2474,22 +2470,17 @@ void gtid_server_cleanup() {
24742470
false if OK
24752471
*/
24762472
bool gtid_server_init() {
2473+
global_gtid_mode.set(
2474+
static_cast<Gtid_mode::value_type>(Gtid_mode::sysvar_mode));
24772475
bool res = (!(global_sid_lock = new Checkable_rwlock(
24782476
#ifdef HAVE_PSI_INTERFACE
24792477
key_rwlock_global_sid_lock
2480-
#endif
2481-
)) ||
2482-
!(gtid_mode_lock = new Checkable_rwlock(
2483-
#ifdef HAVE_PSI_INTERFACE
2484-
key_rwlock_gtid_mode_lock
24852478
#endif
24862479
)) ||
24872480
!(global_sid_map = new Sid_map(global_sid_lock)) ||
24882481
!(gtid_state = new Gtid_state(global_sid_lock, global_sid_map)) ||
24892482
!(gtid_table_persistor = new Gtid_table_persistor()));
24902483

2491-
gtid_mode_counter = 1;
2492-
24932484
if (res) {
24942485
gtid_server_cleanup();
24952486
}
@@ -5778,8 +5769,7 @@ static int init_server_components() {
57785769
}
57795770

57805771
if (opt_log_slave_updates && replicate_same_server_id) {
5781-
enum_gtid_mode gtid_mode = get_gtid_mode(GTID_MODE_LOCK_NONE);
5782-
if (opt_bin_log && gtid_mode != GTID_MODE_ON) {
5772+
if (opt_bin_log && global_gtid_mode.get() != Gtid_mode::ON) {
57835773
LogErr(ERROR_LEVEL, ER_RPL_INFINITY_DENIED);
57845774
unireg_abort(MYSQLD_ABORT_EXIT);
57855775
} else
@@ -6189,10 +6179,7 @@ static int init_server_components() {
61896179
unireg_abort(MYSQLD_ABORT_EXIT);
61906180
}
61916181

6192-
/// @todo: this looks suspicious, revisit this /sven
6193-
enum_gtid_mode gtid_mode = get_gtid_mode(GTID_MODE_LOCK_NONE);
6194-
6195-
if (gtid_mode == GTID_MODE_ON &&
6182+
if (global_gtid_mode.get() == Gtid_mode::ON &&
61966183
_gtid_consistency_mode != GTID_CONSISTENCY_MODE_ON) {
61976184
LogErr(ERROR_LEVEL, ER_RPL_GTID_MODE_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON);
61986185
unireg_abort(MYSQLD_ABORT_EXIT);

sql/mysqld.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ extern PSI_mutex_key key_mutex_slave_worker_hash;
445445
extern PSI_rwlock_key key_rwlock_LOCK_logger;
446446
extern PSI_rwlock_key key_rwlock_channel_map_lock;
447447
extern PSI_rwlock_key key_rwlock_channel_lock;
448+
extern PSI_rwlock_key key_rwlock_gtid_mode_lock;
448449
extern PSI_rwlock_key key_rwlock_receiver_sid_lock;
449450
extern PSI_rwlock_key key_rwlock_rpl_filter_lock;
450451
extern PSI_rwlock_key key_rwlock_channel_to_filter_lock;

sql/replication.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ typedef struct Trans_table_info {
9797
*/
9898
typedef struct Trans_context_info {
9999
bool binlog_enabled;
100-
ulong gtid_mode; // enum values in enum_gtid_mode
100+
ulong gtid_mode; // enum values in Gtid_mode::value_type
101101
bool log_slave_updates;
102102
ulong binlog_checksum_options; // enum values in enum
103103
// enum_binlog_checksum_alg

sql/rpl_binlog_sender.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
22

33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -165,14 +165,14 @@ void Binlog_sender::init() {
165165
}
166166

167167
if (m_using_gtid_protocol) {
168-
enum_gtid_mode gtid_mode = get_gtid_mode_from_copy(GTID_MODE_LOCK_NONE);
169-
if (gtid_mode != GTID_MODE_ON) {
168+
auto gtid_mode = global_gtid_mode.get();
169+
if (gtid_mode != Gtid_mode::ON) {
170170
char buf[MYSQL_ERRMSG_SIZE];
171171
sprintf(buf,
172172
"The replication sender thread cannot start in "
173173
"AUTO_POSITION mode: this server has GTID_MODE = %.192s "
174174
"instead of ON.",
175-
get_gtid_mode_string(gtid_mode));
175+
Gtid_mode::to_string(gtid_mode));
176176
set_fatal_error(buf);
177177
return;
178178
}
@@ -584,7 +584,7 @@ bool Binlog_sender::check_event_type(Log_event_type type, const char *log_file,
584584
GTID_MODE to ON when the slave has not yet replicated all
585585
anonymous transactions.
586586
*/
587-
else if (get_gtid_mode_from_copy(GTID_MODE_LOCK_NONE) == GTID_MODE_ON) {
587+
else if (global_gtid_mode.get() == Gtid_mode::ON) {
588588
char buf[MYSQL_ERRMSG_SIZE];
589589
snprintf(buf, MYSQL_ERRMSG_SIZE,
590590
ER_THD(m_thd, ER_CANT_REPLICATE_ANONYMOUS_WITH_GTID_MODE_ON),
@@ -600,7 +600,7 @@ bool Binlog_sender::check_event_type(Log_event_type type, const char *log_file,
600600
GTID_MODE to OFF when the slave has not yet replicated all GTID
601601
transactions.
602602
*/
603-
if (get_gtid_mode_from_copy(GTID_MODE_LOCK_NONE) == GTID_MODE_OFF) {
603+
if (global_gtid_mode.get() == Gtid_mode::OFF) {
604604
char buf[MYSQL_ERRMSG_SIZE];
605605
snprintf(buf, MYSQL_ERRMSG_SIZE,
606606
ER_THD(m_thd, ER_CANT_REPLICATE_GTID_WITH_GTID_MODE_OFF),

sql/rpl_binlog_sender.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
22

33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -44,7 +44,7 @@ class THD;
4444
The major logic of dump thread is implemented in this class. It sends
4545
required binlog events to clients according to their requests.
4646
*/
47-
class Binlog_sender : Gtid_mode_copy {
47+
class Binlog_sender {
4848
class Event_allocator;
4949
typedef Basic_binlog_file_reader<Binlog_ifile, Binlog_event_data_istream,
5050
Binlog_event_object_istream, Event_allocator>

sql/rpl_context.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
22

33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -98,7 +98,7 @@ bool Session_consistency_gtids_ctx::notify_after_gtid_executed_update(
9898
if (!shall_collect(thd)) return res;
9999

100100
if (m_curr_session_track_gtids == OWN_GTID) {
101-
DBUG_ASSERT(get_gtid_mode(GTID_MODE_LOCK_SID) != GTID_MODE_OFF);
101+
DBUG_ASSERT(global_gtid_mode.get() != Gtid_mode::OFF);
102102
DBUG_ASSERT(thd->owned_gtid.sidno > 0);
103103
const Gtid &gtid = thd->owned_gtid;
104104
if (gtid.sidno == -1) // we need to add thd->owned_gtid_set

sql/rpl_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
22

33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,

0 commit comments

Comments
 (0)