Skip to content

Commit b6776e9

Browse files
author
Karolina Szczepankiewicz
committed
WL#15294 Extending GTID with tags to identify group of transactions - step 7
Step 7. Rename remaining '*sid*' related type names, function names and variables into '*tsid*' Change-Id: I0f28272a5b93ce081623436f9a957aba76f9e91b
1 parent 215fec6 commit b6776e9

File tree

73 files changed

+1189
-1197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1189
-1197
lines changed

client/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) 2006, 2023, Oracle and/or its affiliates.
2-
#
2+
#
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,
55
# as published by the Free Software Foundation.
@@ -228,7 +228,7 @@ SET(MYSQLBINLOG_SOURCES
228228
mysqlbinlog.cc
229229
${CMAKE_SOURCE_DIR}/sql/log_event.cc
230230
${CMAKE_SOURCE_DIR}/sql/rpl_utility.cc
231-
${CMAKE_SOURCE_DIR}/sql/rpl_gtid_sid_map.cc
231+
${CMAKE_SOURCE_DIR}/sql/rpl_gtid_tsid_map.cc
232232
${CMAKE_SOURCE_DIR}/sql/rpl_gtid_misc.cc
233233
${CMAKE_SOURCE_DIR}/sql/rpl_gtid_set.cc
234234
${CMAKE_SOURCE_DIR}/sql/rpl_gtid_specification.cc

client/mysqlbinlog.cc

+17-17
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,8 @@ static MYSQL *mysql_handle = nullptr;
783783
static char *dirname_for_local_load = nullptr;
784784
static uint opt_server_id_bits = 0;
785785
ulong opt_server_id_mask = 0;
786-
Sid_map *global_sid_map = nullptr;
787-
Checkable_rwlock *global_sid_lock = nullptr;
786+
Tsid_map *global_tsid_map = nullptr;
787+
Checkable_rwlock *global_tsid_lock = nullptr;
788788
Gtid_set *gtid_set_included = nullptr;
789789
Gtid_set *gtid_set_excluded = nullptr;
790790
static uint opt_zstd_compress_level = default_zstd_compression_level;
@@ -2596,8 +2596,8 @@ static void fix_gtid_set(MYSQL_RPL *rpl, uchar *packet_gtid_set) {
25962596
Note: we acquire lock in the dump_remote_log_entries()
25972597
just before mysql_binlog_open() call if GTID used.
25982598
*/
2599-
global_sid_lock->assert_some_rdlock();
2600-
global_sid_lock->unlock();
2599+
global_tsid_lock->assert_some_rdlock();
2600+
global_tsid_lock->unlock();
26012601
}
26022602

26032603
/*
@@ -2688,7 +2688,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
26882688
if (opt_remote_proto != BINLOG_DUMP_NON_GTID) {
26892689
rpl.flags |= MYSQL_RPL_GTID;
26902690

2691-
global_sid_lock->rdlock();
2691+
global_tsid_lock->rdlock();
26922692
rpl.gtid_set_encoded_size = gtid_set_excluded->get_encoded_length();
26932693
rpl.fix_gtid_set = fix_gtid_set;
26942694
rpl.gtid_set_arg = (void *)gtid_set_excluded;
@@ -3191,13 +3191,13 @@ static int args_post_process(void) {
31913191
}
31923192
}
31933193

3194-
global_sid_lock->rdlock();
3194+
global_tsid_lock->rdlock();
31953195

31963196
if (opt_include_gtids_str != nullptr) {
31973197
if (gtid_set_included->add_gtid_text(opt_include_gtids_str) !=
31983198
RETURN_STATUS_OK) {
31993199
error("Could not configure --include-gtids '%s'", opt_include_gtids_str);
3200-
global_sid_lock->unlock();
3200+
global_tsid_lock->unlock();
32013201
return ERROR_STOP;
32023202
}
32033203
}
@@ -3206,12 +3206,12 @@ static int args_post_process(void) {
32063206
if (gtid_set_excluded->add_gtid_text(opt_exclude_gtids_str) !=
32073207
RETURN_STATUS_OK) {
32083208
error("Could not configure --exclude-gtids '%s'", opt_exclude_gtids_str);
3209-
global_sid_lock->unlock();
3209+
global_tsid_lock->unlock();
32103210
return ERROR_STOP;
32113211
}
32123212
}
32133213

3214-
global_sid_lock->unlock();
3214+
global_tsid_lock->unlock();
32153215

32163216
if (connection_server_id == 0 && stop_never)
32173217
error("Cannot set --server-id=0 when --stop-never is specified.");
@@ -3229,12 +3229,12 @@ static int args_post_process(void) {
32293229
Function is reentrant.
32303230
*/
32313231
inline void gtid_client_cleanup() {
3232-
delete global_sid_lock;
3233-
delete global_sid_map;
3232+
delete global_tsid_lock;
3233+
delete global_tsid_map;
32343234
delete gtid_set_excluded;
32353235
delete gtid_set_included;
3236-
global_sid_lock = nullptr;
3237-
global_sid_map = nullptr;
3236+
global_tsid_lock = nullptr;
3237+
global_tsid_map = nullptr;
32383238
gtid_set_excluded = nullptr;
32393239
gtid_set_included = nullptr;
32403240
}
@@ -3246,10 +3246,10 @@ inline void gtid_client_cleanup() {
32463246
false if OK
32473247
*/
32483248
inline bool gtid_client_init() {
3249-
const bool res = (!(global_sid_lock = new Checkable_rwlock) ||
3250-
!(global_sid_map = new Sid_map(global_sid_lock)) ||
3251-
!(gtid_set_excluded = new Gtid_set(global_sid_map)) ||
3252-
!(gtid_set_included = new Gtid_set(global_sid_map)));
3249+
const bool res = (!(global_tsid_lock = new Checkable_rwlock) ||
3250+
!(global_tsid_map = new Tsid_map(global_tsid_lock)) ||
3251+
!(gtid_set_excluded = new Gtid_set(global_tsid_map)) ||
3252+
!(gtid_set_included = new Gtid_set(global_tsid_map)));
32533253
if (res) {
32543254
gtid_client_cleanup();
32553255
}

include/mysql/group_replication_priv.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ char *encoded_gtid_set_to_string(uchar *encoded_gtid_set, size_t length);
163163
rpl_gno get_last_executed_gno(rpl_sidno sidno);
164164

165165
/**
166-
Return sidno for a given tsid, see Sid_map::add_tsid() for details.
166+
Return sidno for a given tsid, see Tsid_map::add_tsid() for details.
167167
*/
168-
rpl_sidno get_sidno_from_global_sid_map(const mysql::gtid::Tsid &tsid);
168+
rpl_sidno get_sidno_from_global_tsid_map(const mysql::gtid::Tsid &tsid);
169169

170170
/**
171171
Set slave thread default options.

libs/mysql/binlog/event/control_events.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ class Transaction_payload_event : public Binary_log_event {
926926
@class Gtid_event
927927
GTID stands for Global Transaction IDentifier
928928
It is composed of two parts:
929-
- SID for Source Identifier, and
929+
- TSID for Transaction Source Identifier, and
930930
- GNO for Group Number.
931931
The basic idea is to
932932
- Associate an identifier, the Global Transaction IDentifier or GTID,

libs/mysql/gtid/gtidset.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class Gtid_set {
248248
using Tsid = mysql::gtid::Tsid;
249249

250250
protected:
251-
[[NODISCARD]] virtual bool do_add(const Tsid &uuid,
251+
[[NODISCARD]] virtual bool do_add(const Tsid &tsid,
252252
const Gno_interval &interval);
253253
[[NODISCARD]] virtual bool do_add(const Uuid &uuid, const Tag &tag,
254254
const Gno_interval &interval);
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
include/rpl_init.inc [topology=none]
22
CREATE TABLE t1 (a INT);
3-
SET @@SESSION.DEBUG_SYNC = 'update_gtid_state_before_global_sid_lock SIGNAL before_global_sid_lock WAIT_FOR have_gtid_mode_lock';
4-
SET @@SESSION.DEBUG_SYNC = 'update_gtid_state_after_global_sid_lock SIGNAL have_global_sid_lock';
3+
SET @@SESSION.DEBUG_SYNC = 'update_gtid_state_before_global_tsid_lock SIGNAL before_global_tsid_lock WAIT_FOR have_gtid_mode_lock';
4+
SET @@SESSION.DEBUG_SYNC = 'update_gtid_state_after_global_tsid_lock SIGNAL have_global_tsid_lock';
55
SET @@SESSION.GTID_NEXT= 'ANONYMOUS';
66
INSERT INTO t1 VALUES (1);
7-
SET @@SESSION.DEBUG_SYNC = 'now WAIT_FOR before_global_sid_lock';
8-
SET @@SESSION.DEBUG_SYNC= 'after_log_file_name_initialized SIGNAL have_gtid_mode_lock WAIT_FOR have_global_sid_lock';
7+
SET @@SESSION.DEBUG_SYNC = 'now WAIT_FOR before_global_tsid_lock';
8+
SET @@SESSION.DEBUG_SYNC= 'after_log_file_name_initialized SIGNAL have_gtid_mode_lock WAIT_FOR have_global_tsid_lock';
99
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
1010
SET @@GLOBAL.GTID_MODE = OFF;
1111
DROP TABLE t1;

mysql-test/suite/binlog_nogtid/t/binlog_gtid_state_update_deadlock.test

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ==== Purpose ====
22
#
33
# Verify that gtid_state->update_gtids_impl does not take
4-
# global_sid_lock before gtid_mode_lock. It once did, and this could
4+
# global_tsid_lock before gtid_mode_lock. It once did, and this could
55
# lead to a deadlock with a concurrent SET GTID_MODE.
66
#
77
# Note: if we implement on-the-fly lock order validation with
@@ -10,26 +10,26 @@
1010
# ==== Implementation ====
1111
#
1212
# 1. server_1 starts to execute an INSERT. It pauses before it takes
13-
# global_sid_lock in gtid_state->update_gtids_impl (sync point
14-
# 'update_gtid_state_before_global_sid_lock). It signals to default
15-
# that it has reached this point (signal 'before_global_sid_lock').
13+
# global_tsid_lock in gtid_state->update_gtids_impl (sync point
14+
# 'update_gtid_state_before_global_tsid_lock). It signals to default
15+
# that it has reached this point (signal 'before_global_tsid_lock').
1616
#
17-
# 2. default receives 'before_global_sid_lock'.
17+
# 2. default receives 'before_global_tsid_lock'.
1818
#
1919
# 3. server_1_1 starts to execute SET GTID_MODE. It takes
20-
# gtid_mode_lock. Then it pauses before it takes global_sid_lock
20+
# gtid_mode_lock. Then it pauses before it takes global_tsid_lock
2121
# (sync point 'after_log_file_name_initialized'). At the same time
2222
# it signals server_1 to continue (signal 'have_gtid_mode_lock').
2323
#
24-
# 4. server_1 unpauses. Then it takes global_sid_lock. Then it signals
25-
# to server_1_1 to continue (signal 'have_global_sid_lock' from
26-
# sync point 'update_gtid_state_after_global_sid_lock').
24+
# 4. server_1 unpauses. Then it takes global_tsid_lock. Then it signals
25+
# to server_1_1 to continue (signal 'have_global_tsid_lock' from
26+
# sync point 'update_gtid_state_after_global_tsid_lock').
2727
#
28-
# 5. server_1 continues; it holds global_sid_lock and tries to acquire
28+
# 5. server_1 continues; it holds global_tsid_lock and tries to acquire
2929
# gtid_mode_lock.
3030
#
3131
# 6. server_1_1 continues; it holds gtid_mode_lock and tries to acquire
32-
# global_sid_lock.
32+
# global_tsid_lock.
3333

3434
--source include/big_test.inc
3535
--source include/have_debug_sync.inc
@@ -42,22 +42,22 @@
4242
CREATE TABLE t1 (a INT);
4343

4444
--connection server_1
45-
# 1. wait before global_sid_lock in update_gtids_impl.
46-
SET @@SESSION.DEBUG_SYNC = 'update_gtid_state_before_global_sid_lock SIGNAL before_global_sid_lock WAIT_FOR have_gtid_mode_lock';
47-
# 4. once released, take global_sid_lock, signal SET GTID_MODE to continue.
45+
# 1. wait before global_tsid_lock in update_gtids_impl.
46+
SET @@SESSION.DEBUG_SYNC = 'update_gtid_state_before_global_tsid_lock SIGNAL before_global_tsid_lock WAIT_FOR have_gtid_mode_lock';
47+
# 4. once released, take global_tsid_lock, signal SET GTID_MODE to continue.
4848
# 5. continue into the deadlock.
49-
SET @@SESSION.DEBUG_SYNC = 'update_gtid_state_after_global_sid_lock SIGNAL have_global_sid_lock';
49+
SET @@SESSION.DEBUG_SYNC = 'update_gtid_state_after_global_tsid_lock SIGNAL have_global_tsid_lock';
5050
SET @@SESSION.GTID_NEXT= 'ANONYMOUS';
5151
send INSERT INTO t1 VALUES (1);
5252

53-
# 2. wait for INSERT to be just before the global_sid_lock.
53+
# 2. wait for INSERT to be just before the global_tsid_lock.
5454
--connection default
55-
SET @@SESSION.DEBUG_SYNC = 'now WAIT_FOR before_global_sid_lock';
55+
SET @@SESSION.DEBUG_SYNC = 'now WAIT_FOR before_global_tsid_lock';
5656

5757
--connection server_1_1
58-
# 3. wait when holding gtid_mode_lock, before takeing global_sid_lock.
59-
# 6. once the INSERT has taken global_sid_lock, unpause and hit the deadlock
60-
SET @@SESSION.DEBUG_SYNC= 'after_log_file_name_initialized SIGNAL have_gtid_mode_lock WAIT_FOR have_global_sid_lock';
58+
# 3. wait when holding gtid_mode_lock, before takeing global_tsid_lock.
59+
# 6. once the INSERT has taken global_tsid_lock, unpause and hit the deadlock
60+
SET @@SESSION.DEBUG_SYNC= 'after_log_file_name_initialized SIGNAL have_gtid_mode_lock WAIT_FOR have_global_tsid_lock';
6161
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
6262

6363
--connection server_1

mysql-test/suite/rpl_gtid/t/rpl_wait_for_executed_gtid_set.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
# UUIDs, where all the GTIDs for one of the UUIDs are already
6868
# committed before the function starts.
6969
# 7.6. The function waits for a UUID which does not already exist
70-
# in global_sid_map.
70+
# in global_tsid_map.
7171
# This should all work in case the GTIDs are committed:
7272
# 7A. from a client on the same server using GTID_NEXT=AUTOMATIC
7373
# 7B. from a client on the same server using GTID_NEXT=UUID:NUMBER

mysql-test/suite/rpl_gtid/t/rpl_wait_for_gtid_executed_unknown_uuid.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WL#7796 - WAIT_FOR_EXECUTED_GTID_SET
22
# Test to check for the condition that the given UUID is not already on the
3-
# global_sid_map.
3+
# global_tsid_map.
44

55
--source include/not_group_replication_plugin.inc
66
--source include/master-slave.inc

plugin/group_replication/include/certifier.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
*/
7373
class Gtid_set_ref : public Gtid_set {
7474
public:
75-
Gtid_set_ref(Sid_map *sid_map, int64 parallel_applier_sequence_number)
76-
: Gtid_set(sid_map),
75+
Gtid_set_ref(Tsid_map *tsid_map, int64 parallel_applier_sequence_number)
76+
: Gtid_set(tsid_map),
7777
reference_counter(0),
7878
parallel_applier_sequence_number(parallel_applier_sequence_number) {}
7979

@@ -486,7 +486,7 @@ class Certifier : public Certifier_interface {
486486
Variable to store the sidno used for transactions which will be logged
487487
with the group_uuid.
488488
*/
489-
rpl_sidno group_gtid_sid_map_group_sidno;
489+
rpl_sidno group_gtid_tsid_map_group_sidno;
490490

491491
/**
492492
The sidno used for view log events as seen by the group sid map
@@ -693,7 +693,7 @@ class Certifier : public Certifier_interface {
693693
Certification database.
694694
*/
695695
Certification_info certification_info;
696-
Sid_map *certification_info_sid_map;
696+
Tsid_map *certification_info_tsid_map;
697697

698698
ulonglong positive_cert;
699699
ulonglong negative_cert;
@@ -711,7 +711,7 @@ class Certifier : public Certifier_interface {
711711
Stable set and garbage collector variables.
712712
*/
713713
Checkable_rwlock *stable_gtid_set_lock;
714-
Sid_map *stable_sid_map;
714+
Tsid_map *stable_tsid_map;
715715
Gtid_set *stable_gtid_set;
716716
Synchronized_queue<Data_packet *> *incoming;
717717

@@ -764,7 +764,7 @@ class Certifier : public Certifier_interface {
764764
/*
765765
Sid map to store the GTIDs that are executed in the group.
766766
*/
767-
Sid_map *group_gtid_sid_map;
767+
Tsid_map *group_gtid_tsid_map;
768768

769769
/*
770770
A Gtid_set containing the already executed for the group.

plugin/group_replication/src/applier.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,16 @@ int Applier_module::apply_view_change_packet(
274274
const auto garbage_collection_begin = Metrics_handler::get_current_time();
275275

276276
Gtid_set *group_executed_set = nullptr;
277-
Sid_map *sid_map = nullptr;
277+
Tsid_map *tsid_map = nullptr;
278278
if (!view_change_packet->group_executed_set.empty()) {
279-
sid_map = new Sid_map(nullptr);
280-
group_executed_set = new Gtid_set(sid_map, nullptr);
279+
tsid_map = new Tsid_map(nullptr);
280+
group_executed_set = new Gtid_set(tsid_map, nullptr);
281281
if (intersect_group_executed_sets(view_change_packet->group_executed_set,
282282
group_executed_set)) {
283283
LogPluginErr(
284284
WARNING_LEVEL,
285285
ER_GRP_RPL_ERROR_GTID_EXECUTION_INFO); /* purecov: inspected */
286-
delete sid_map; /* purecov: inspected */
286+
delete tsid_map; /* purecov: inspected */
287287
delete group_executed_set; /* purecov: inspected */
288288
group_executed_set = nullptr; /* purecov: inspected */
289289
}
@@ -296,7 +296,7 @@ int Applier_module::apply_view_change_packet(
296296
LogPluginErr(WARNING_LEVEL,
297297
ER_GRP_RPL_CERTIFICATE_SIZE_ERROR); /* purecov: inspected */
298298
}
299-
delete sid_map;
299+
delete tsid_map;
300300
delete group_executed_set;
301301
}
302302

@@ -1010,13 +1010,13 @@ Certification_handler *Applier_module::get_certification_handler() {
10101010

10111011
int Applier_module::intersect_group_executed_sets(
10121012
std::vector<std::string> &gtid_sets, Gtid_set *output_set) {
1013-
Sid_map *sid_map = output_set->get_sid_map();
1013+
Tsid_map *tsid_map = output_set->get_tsid_map();
10141014

10151015
std::vector<std::string>::iterator set_iterator;
10161016
for (set_iterator = gtid_sets.begin(); set_iterator != gtid_sets.end();
10171017
set_iterator++) {
1018-
Gtid_set member_set(sid_map, nullptr);
1019-
Gtid_set intersection_result(sid_map, nullptr);
1018+
Gtid_set member_set(tsid_map, nullptr);
1019+
Gtid_set intersection_result(tsid_map, nullptr);
10201020

10211021
std::string exec_set_str = (*set_iterator);
10221022

0 commit comments

Comments
 (0)