Skip to content

Commit 2da995d

Browse files
committed
Merge branch 'mysql-8.0' into mysql-8.4
Change-Id: I592220877e13788523c3c2dd89182cc2078f89b0
2 parents afef6e8 + 745449d commit 2da995d

File tree

6 files changed

+30
-32
lines changed

6 files changed

+30
-32
lines changed

mysql-test/suite/group_replication/r/gr_partial_trx_in_applier_relay_log.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ INSERT INTO t1 values (12);
4040
SET GLOBAL DEBUG="-d,stop_applier_channel_after_reading_write_rows_log_event";
4141
include/stop_group_replication.inc
4242
include/start_group_replication.inc
43+
include/assert.inc [Certifier broadcast thread must be running]
4344
########################################################################
4445
# 5. On M1: Insert another tuple and do a diff tables with other nodes.
4546
# (just to check that everything is working fine).

mysql-test/suite/group_replication/t/gr_partial_trx_in_applier_relay_log.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ SET GLOBAL DEBUG="-d,stop_applier_channel_after_reading_write_rows_log_event";
9393
--let $wait_timeout=120
9494
--source include/start_group_replication.inc
9595

96+
--let $assert_text= Certifier broadcast thread must be running
97+
--let $assert_cond= [SELECT COUNT(*) FROM performance_schema.threads WHERE name = "thread/group_rpl/THD_certifier_broadcast"] = 1
98+
--source include/assert.inc
99+
96100
--echo ########################################################################
97101
--echo # 5. On M1: Insert another tuple and do a diff tables with other nodes.
98102
--echo # (just to check that everything is working fine).

plugin/group_replication/include/certifier.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,8 @@ class Certifier_broadcast_thread {
169169

170170
/**
171171
Terminate broadcast thread.
172-
173-
@return the operation status
174-
@retval 0 OK
175-
@retval !=0 Error
176172
*/
177-
int terminate();
173+
void terminate();
178174

179175
/**
180176
Broadcast thread worker method.
@@ -268,15 +264,6 @@ class Certifier : public Certifier_interface {
268264
*/
269265
int initialize(ulonglong gtid_assignment_block_size);
270266

271-
/**
272-
Terminate certifier.
273-
274-
@return the operation status
275-
@retval 0 OK
276-
@retval !=0 Error
277-
*/
278-
int terminate();
279-
280267
/**
281268
Handle view changes on certifier.
282269
*/

plugin/group_replication/src/certifier.cc

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@ int Certifier_broadcast_thread::initialize() {
9191
if ((mysql_thread_create(key_GR_THD_cert_broadcast, &broadcast_pthd,
9292
get_connection_attrib(), launch_broadcast_thread,
9393
(void *)this))) {
94-
mysql_mutex_unlock(&broadcast_run_lock); /* purecov: inspected */
95-
return 1; /* purecov: inspected */
94+
/* purecov: begin inspected */
95+
mysql_mutex_unlock(&broadcast_run_lock);
96+
LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_CERT_BROADCAST_THREAD_CREATE_FAILED);
97+
return 1;
98+
/* purecov: end */
9699
}
97100
broadcast_thd_state.set_created();
98101

@@ -105,13 +108,13 @@ int Certifier_broadcast_thread::initialize() {
105108
return 0;
106109
}
107110

108-
int Certifier_broadcast_thread::terminate() {
111+
void Certifier_broadcast_thread::terminate() {
109112
DBUG_TRACE;
110113

111114
mysql_mutex_lock(&broadcast_run_lock);
112115
if (broadcast_thd_state.is_thread_dead()) {
113116
mysql_mutex_unlock(&broadcast_run_lock);
114-
return 0;
117+
return;
115118
}
116119

117120
aborted = true;
@@ -129,8 +132,6 @@ int Certifier_broadcast_thread::terminate() {
129132
mysql_cond_wait(&broadcast_run_cond, &broadcast_run_lock);
130133
}
131134
mysql_mutex_unlock(&broadcast_run_lock);
132-
133-
return 0;
134135
}
135136

136137
void Certifier_broadcast_thread::dispatcher() {
@@ -150,6 +151,8 @@ void Certifier_broadcast_thread::dispatcher() {
150151
mysql_cond_broadcast(&broadcast_run_cond);
151152
mysql_mutex_unlock(&broadcast_run_lock);
152153

154+
LogPluginErr(SYSTEM_LEVEL, ER_GRP_RPL_CERT_BROADCAST_THREAD_STARTED);
155+
153156
while (!aborted) {
154157
// Broadcast Transaction identifiers every 30 seconds
155158
if (broadcast_counter % 30 == 0) {
@@ -203,6 +206,8 @@ void Certifier_broadcast_thread::dispatcher() {
203206
mysql_cond_broadcast(&broadcast_run_cond);
204207
mysql_mutex_unlock(&broadcast_run_lock);
205208

209+
LogPluginErr(SYSTEM_LEVEL, ER_GRP_RPL_CERT_BROADCAST_THREAD_STOPPED);
210+
206211
my_thread_exit(nullptr);
207212
}
208213

@@ -311,6 +316,10 @@ Certifier::Certifier()
311316
Certifier::~Certifier() {
312317
mysql_mutex_lock(&LOCK_certification_info);
313318
initialized = false;
319+
320+
broadcast_thread->terminate();
321+
delete broadcast_thread;
322+
314323
clear_certification_info();
315324
delete certification_info_tsid_map;
316325

@@ -321,7 +330,6 @@ Certifier::~Certifier() {
321330
delete group_gtid_extracted;
322331
delete group_gtid_tsid_map;
323332
mysql_mutex_unlock(&LOCK_certification_info);
324-
delete broadcast_thread;
325333

326334
mysql_mutex_lock(&LOCK_members);
327335
clear_members();
@@ -553,15 +561,6 @@ int Certifier::initialize(ulonglong gtid_assignment_block_size) {
553561
return error;
554562
}
555563

556-
int Certifier::terminate() {
557-
DBUG_TRACE;
558-
int error = 0;
559-
560-
if (is_initialized()) error = broadcast_thread->terminate();
561-
562-
return error;
563-
}
564-
565564
void Certifier::update_parallel_applier_indexes(
566565
bool update_parallel_applier_last_committed_global,
567566
bool increment_parallel_applier_sequence_number) {

plugin/group_replication/src/handlers/certification_handler.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ int Certification_handler::handle_action(Pipeline_action *action) {
100100
Handler_THD_setup_action *thd_conf_action =
101101
(Handler_THD_setup_action *)action;
102102
applier_module_thd = thd_conf_action->get_THD_object();
103-
} else if (action_type == HANDLER_STOP_ACTION) {
104-
error = cert_module->terminate();
105103
}
106104

107105
if (error) return error;

share/messages_to_error_log.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12330,6 +12330,15 @@ ER_CHECK_TABLE_FUNCTIONS
1233012330
ER_CHECK_TABLE_FUNCTIONS_DETAIL
1233112331
eng "%s"
1233212332

12333+
ER_GRP_RPL_CERT_BROADCAST_THREAD_CREATE_FAILED
12334+
eng "Failed to create the Group Replication certifier broadcast thread (THD_certifier_broadcast)."
12335+
12336+
ER_GRP_RPL_CERT_BROADCAST_THREAD_STARTED
12337+
eng "The Group Replication certifier broadcast thread (THD_certifier_broadcast) started."
12338+
12339+
ER_GRP_RPL_CERT_BROADCAST_THREAD_STOPPED
12340+
eng "The Group Replication certifier broadcast thread (THD_certifier_broadcast) stopped."
12341+
1233312342
#
1233412343
# End of 8.0 error messages intended to be written to the server error log.
1233512344
#

0 commit comments

Comments
 (0)