Skip to content

Commit 6539e65

Browse files
author
Venkatesh Duggirala
committed
Merge branch 'mysql-5.7' into mysql-trunk
2 parents b371afc + 25a13b0 commit 6539e65

File tree

7 files changed

+462
-8
lines changed

7 files changed

+462
-8
lines changed

rapid/plugin/group_replication/include/handlers/pipeline_handlers.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030
*/
3131
enum enum_event_modifier
3232
{
33-
TRANSACTION_BEGIN= 1, //transaction start event
34-
TRANSACTION_END= 2, //transaction end event
35-
UNMARKED_EVENT= 3, //transaction regular event
33+
TRANSACTION_BEGIN= 1, ///< transaction start event
34+
TRANSACTION_END= 2, ///< transaction end event
35+
UNMARKED_EVENT= 3, ///< transaction regular event
36+
SINGLE_VIEW_EVENT= 4, ///< the current Pipeline_event only contains
37+
///< a single view event injected from GCS
3638
};
3739

3840
/**

rapid/plugin/group_replication/src/applier.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ Applier_module::apply_view_change_packet(View_change_packet *view_change_packet,
289289
= new View_change_log_event((char*)view_change_packet->view_id.c_str());
290290

291291
Pipeline_event* pevent= new Pipeline_event(view_change_event, fde_evt, cache);
292+
pevent->mark_event(SINGLE_VIEW_EVENT);
292293
error= inject_event_into_pipeline(pevent, cont);
293294
delete pevent;
294295

rapid/plugin/group_replication/src/handlers/certification_handler.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,27 @@ Certification_handler::extract_certification_info(Pipeline_event *pevent,
471471
int error= 0;
472472
Log_event *event= NULL;
473473

474+
if (pevent->get_event_context() != SINGLE_VIEW_EVENT)
475+
{
476+
/*
477+
If the current view event is embraced on a transaction:
478+
GTID, BEGIN, VIEW, COMMIT; it means that we are handling
479+
a view that was delivered by a asynchronous channel from
480+
outside of the group.
481+
On that case we just have to queue it on the group applier
482+
channel, without any special handling.
483+
*/
484+
next(pevent, cont);
485+
DBUG_RETURN(error);
486+
}
487+
488+
/*
489+
If the current view event is a standalone event (not inside a
490+
transaction), it means that it was injected from GCS on a
491+
membership change.
492+
On that case we need to queue it on the group applier wrapped
493+
on a transaction with a group generated GTID.
494+
*/
474495
error= pevent->get_LogEvent(&event);
475496
if (error || (event == NULL))
476497
{

rapid/plugin/group_replication/src/handlers/event_cataloger.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2014, 2017, 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 as published by
@@ -38,18 +38,18 @@ Event_cataloger::handle_event(Pipeline_event *pevent, Continuation *cont)
3838
{
3939
pevent->mark_event(TRANSACTION_BEGIN);
4040
}
41-
else
41+
else if (pevent->get_event_context() != SINGLE_VIEW_EVENT)
4242
{
4343
pevent->mark_event(UNMARKED_EVENT);
4444
}
4545

4646
//Check if the current transaction was discarded
4747
if (cont->is_transaction_discarded())
4848
{
49-
if (pevent->get_event_context() == TRANSACTION_BEGIN ||
50-
pevent->get_event_type() == binary_log::VIEW_CHANGE_EVENT)
49+
if ((pevent->get_event_context() == TRANSACTION_BEGIN)||
50+
(pevent->get_event_context() == SINGLE_VIEW_EVENT))
5151
{
52-
//a new transaction begins
52+
//a new transaction begins or we are handling a view change
5353
cont->set_transation_discarded(false);
5454
}
5555
else
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
include/group_replication.inc [rpl_server_count=6]
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection server1]
6+
7+
#################################################################
8+
# 1. Setup Group Replication on M1 and M2 and create group GR1.
9+
SET @@GLOBAL.group_replication_group_seeds= "";
10+
include/start_and_bootstrap_group_replication.inc
11+
SET @@GLOBAL.group_replication_group_seeds= "GROUP_REPLICATION_GROUP_SEEDS";
12+
include/start_group_replication.inc
13+
include/rpl_gr_wait_for_number_of_members.inc
14+
15+
#################################################################
16+
# 2. Setup Group Replication on M1 and M2 and create group GR2.
17+
SET @@GLOBAL.group_replication_group_seeds= "";
18+
include/start_and_bootstrap_group_replication.inc
19+
SET @@GLOBAL.group_replication_group_seeds= "GROUP_REPLICATION_GROUP_SEEDS";
20+
include/start_group_replication.inc
21+
include/rpl_gr_wait_for_number_of_members.inc
22+
23+
###############################################################
24+
# 3. Setup a asynchronous replication connection from M3 (GR2)
25+
# to M1 (GR1).
26+
CHANGE MASTER TO MASTER_HOST="127.0.0.1", MASTER_USER="root", MASTER_PASSWORD="", MASTER_PORT=SERVER_3_PORT, MASTER_AUTO_POSITION=1;
27+
Warnings:
28+
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
29+
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
30+
include/start_slave.inc
31+
32+
###############################################################
33+
# 4. Setup a asynchronous replication connection from M1 (GR1)
34+
# to M3 (GR2).
35+
CHANGE MASTER TO MASTER_HOST="127.0.0.1", MASTER_USER="root", MASTER_PASSWORD="", MASTER_PORT=SERVER_1_PORT, MASTER_AUTO_POSITION=1;
36+
Warnings:
37+
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
38+
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
39+
include/start_slave.inc
40+
41+
###############################################################
42+
# 5. Test view change issue by adding/dropping nodes from the
43+
# groups (just to generate more VIEW_EVENTs).
44+
# 5.1. Add a node M5 to group (GR1).
45+
SET @@GLOBAL.group_replication_group_seeds= "GROUP_REPLICATION_GROUP_SEEDS";
46+
include/start_group_replication.inc
47+
include/rpl_gr_wait_for_number_of_members.inc
48+
49+
################################################################
50+
# 5.2. Add and immediately drop a node M6 to group (GR2).
51+
SET @@GLOBAL.group_replication_group_seeds= "GROUP_REPLICATION_GROUP_SEEDS";
52+
include/start_group_replication.inc
53+
include/rpl_gr_wait_for_number_of_members.inc
54+
include/stop_group_replication.inc
55+
56+
############################################################
57+
# 6. Execute some transactions on M3 (GR2).
58+
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
59+
INSERT INTO t1 VALUES (0);
60+
INSERT INTO t1 VALUES (1);
61+
UPDATE t1 SET c1=2 WHERE c1=0;
62+
DELETE FROM t1 WHERE c1=1;
63+
64+
############################################################
65+
# 7. Wait until transactions executed on M3 are applied
66+
# on all nodes in both groups.
67+
include/sync_slave_sql_with_master.inc
68+
include/sync_slave_sql_with_master.inc
69+
include/sync_slave_sql_with_master.inc
70+
include/sync_slave_sql_with_master.inc
71+
72+
############################################################
73+
# 8. Execute some transactions on M1 (GR1).
74+
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
75+
INSERT INTO t2 VALUES (0);
76+
INSERT INTO t2 VALUES (1);
77+
UPDATE t2 SET c1=2 WHERE c1=0;
78+
DELETE FROM t2 WHERE c1=1;
79+
80+
############################################################
81+
# 9. Wait until transactions executed on M1 are applied
82+
# on all nodes in both groups.
83+
include/sync_slave_sql_with_master.inc
84+
include/sync_slave_sql_with_master.inc
85+
include/sync_slave_sql_with_master.inc
86+
include/sync_slave_sql_with_master.inc
87+
88+
#########################################################################
89+
# 10. Validate data on all nodes (M1, M2, M3, M4 and M5)
90+
include/diff_tables.inc [server_1:t1, server_2:t1, server_3:t1, server_4:t1, server_5:t1]
91+
include/diff_tables.inc [server_1:t2, server_2:t2, server_3:t2, server_4:t2, server_5:t2]
92+
93+
#########################################################################
94+
# 11. Check that GTID_EXECUTED on all servers are as expected.
95+
SET SESSION sql_log_bin= 0;
96+
include/gtid_utils.inc
97+
SET SESSION sql_log_bin= 1;
98+
include/assert.inc [Check that GTID_EXECUTED set on all servers are as expected.]
99+
SET SESSION sql_log_bin= 0;
100+
include/gtid_utils_end.inc
101+
SET SESSION sql_log_bin= 1;
102+
SET SESSION sql_log_bin= 0;
103+
include/gtid_utils.inc
104+
SET SESSION sql_log_bin= 1;
105+
include/assert.inc [Check that GTID_EXECUTED set on all servers are as expected.]
106+
SET SESSION sql_log_bin= 0;
107+
include/gtid_utils_end.inc
108+
SET SESSION sql_log_bin= 1;
109+
SET SESSION sql_log_bin= 0;
110+
include/gtid_utils.inc
111+
SET SESSION sql_log_bin= 1;
112+
include/assert.inc [Check that GTID_EXECUTED set on all servers are as expected.]
113+
SET SESSION sql_log_bin= 0;
114+
include/gtid_utils_end.inc
115+
SET SESSION sql_log_bin= 1;
116+
SET SESSION sql_log_bin= 0;
117+
include/gtid_utils.inc
118+
SET SESSION sql_log_bin= 1;
119+
include/assert.inc [Check that GTID_EXECUTED set on all servers are as expected.]
120+
SET SESSION sql_log_bin= 0;
121+
include/gtid_utils_end.inc
122+
SET SESSION sql_log_bin= 1;
123+
SET SESSION sql_log_bin= 0;
124+
include/gtid_utils.inc
125+
SET SESSION sql_log_bin= 1;
126+
include/assert.inc [Check that GTID_EXECUTED set on all servers are as expected.]
127+
SET SESSION sql_log_bin= 0;
128+
include/gtid_utils_end.inc
129+
SET SESSION sql_log_bin= 1;
130+
131+
############################################################
132+
# 12. Clean data.
133+
DROP TABLE t1;
134+
DROP TABLE t2;
135+
include/sync_slave_sql_with_master.inc
136+
include/sync_slave_sql_with_master.inc
137+
include/sync_slave_sql_with_master.inc
138+
include/sync_slave_sql_with_master.inc
139+
140+
##############################################################
141+
# 13. Stop asynchronous replication between M3->M1 and M1->M3.
142+
include/stop_slave.inc
143+
CHANGE MASTER TO MASTER_AUTO_POSITION=0 FOR CHANNEL "";
144+
include/stop_slave.inc
145+
CHANGE MASTER TO MASTER_AUTO_POSITION=0 FOR CHANNEL "";
146+
147+
############################################################
148+
# 14. Stop Group Replication on all 5 nodes.
149+
include/stop_group_replication.inc
150+
include/stop_group_replication.inc
151+
include/stop_group_replication.inc
152+
include/stop_group_replication.inc
153+
include/stop_group_replication.inc
154+
include/group_replication_end.inc
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
!include ../my.cnf
2+
3+
[mysqld.1]
4+
5+
[mysqld.2]
6+
7+
[mysqld.3]
8+
9+
[mysqld.4]
10+
11+
[mysqld.5]
12+
13+
[mysqld.6]
14+
15+
[ENV]
16+
SERVER_MYPORT_3= @mysqld.3.port
17+
SERVER_MYSOCK_3= @mysqld.3.socket
18+
19+
SERVER_MYPORT_4= @mysqld.4.port
20+
SERVER_MYSOCK_4= @mysqld.4.socket
21+
22+
SERVER_MYPORT_5= @mysqld.5.port
23+
SERVER_MYSOCK_5= @mysqld.5.socket
24+
25+
SERVER_MYPORT_6= @mysqld.6.port
26+
SERVER_MYSOCK_6= @mysqld.6.socket

0 commit comments

Comments
 (0)