Skip to content

Commit 68514fa

Browse files
committed
WL#10655 - Global notification for GR membership changes
The purpose of this worklog is to supply to the client an information about group replication view changes without pulling the system by the client. On X Protocol level, client can enable following group-replication notices: quorum loss, view change, role change, state change. Approved-by: Mohit Joshi <[email protected]>
1 parent 71f9f83 commit 68514fa

File tree

182 files changed

+8365
-2210
lines changed

Some content is hidden

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

182 files changed

+8365
-2210
lines changed
Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1+
#==== Usage ====
2+
#
3+
#[--let $create_user_disable_binlog = 1]
4+
#-- source include/xplugin_create_user.inc
5+
#
6+
17
--disable_query_log
2-
CREATE USER 'x_root'@'localhost' IDENTIFIED WITH 'mysql_native_password';
3-
GRANT ALL ON *.* TO 'x_root'@'localhost' WITH GRANT OPTION;
8+
9+
if ($create_user_disable_binlog)
10+
{
11+
SET SESSION sql_log_bin = 0;
12+
}
13+
14+
CREATE USER 'x_root' @'localhost' IDENTIFIED WITH 'mysql_native_password';
15+
GRANT ALL ON *.*TO 'x_root' @'localhost' WITH GRANT OPTION;
16+
17+
if ($create_user_disable_binlog)
18+
{
19+
SET SESSION sql_log_bin = 1;
20+
}
21+
422
--enable_query_log

mysql-test/suite/x/r/mysqlxtest_help.result

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ The following commands may appear in the input script:
135135
Stops reading commands, disconnects and exits (same as <eof>/^D)
136136
-->abort
137137
Exit immediately, without performing cleanup
138+
-->shutdown_server [timeout]
139+
Shutdown the server associated with current session,
140+
in case when the 'timeout' argument was set to '0'(for now it only supported
141+
option), the command kills the server.
138142
-->nowarnings/-->yeswarnings
139143
Whether to print warnings generated by the statement (default no)
140144
-->recvuntildisc [show-received]
@@ -149,10 +153,18 @@ The following commands may appear in the input script:
149153
-->loginerror <errno> <user> <pass> <db>
150154
Performs authentication steps expecting an error (use with --no-auth)
151155
-->fatalerrors/nofatalerrors
152-
Whether to immediately exit on MySQL errors
153-
-->expecterror <errno>
154-
Expect a specific error for the next command and fail if something else occurs
155-
Works for: newsession, closesession, recvresult, recvok
156+
Whether to immediately exit on MySQL errors.
157+
All expected errors are ignored.
158+
-->fatalwarnings [yes|no|true|false|1|0]
159+
Whether to immediately exit on MySQL warnings.
160+
All expected warnings are ignored.
161+
-->expectwarnings <errno>[,<errno>[,<errno>...]]
162+
Expect a specific warning for the next command. Fails if warning other than specified occurred.
163+
When this command was not used then all warnings are expected.
164+
Works for: recvresult, SQL
165+
-->expecterror <errno>[,<errno>[,<errno>...]]
166+
Expect a specific error for the next command. Fails if error other than specified occurred
167+
Works for: newsession, closesession, recvresult, recvok, SQL
156168
-->newsession <name> <user> <pass> <db>
157169
Create a new connection which is going to be authenticate using sequence of mechanisms (AUTO). Use '-' in place of the user for raw connection.
158170
-->newsession_mysql41 <name> <user> <pass> <db>
@@ -161,6 +173,8 @@ The following commands may appear in the input script:
161173
Create a new connection which is going to be authenticate using SHA256_MEMORY mechanism.
162174
-->newsession_plain <name> <user> <pass> <db>
163175
Create a new connection which is going to be authenticate using PLAIN mechanism.
176+
-->reconnect
177+
Try to restore the connection/session. Default connection is restored or session established by '-->newsession*'.
164178
-->setsession <name>
165179
Activate the named session
166180
-->closesession [abort]

mysql-test/suite/x/r/notice_warning.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,26 @@ Mysqlx.Resultset.Row {
340340
field: "\002"
341341
}
342342

343+
Mysqlx.Resultset.Row {
344+
field: "group_replication/membership/quorum_loss\000"
345+
field: "\000"
346+
}
347+
348+
Mysqlx.Resultset.Row {
349+
field: "group_replication/membership/view\000"
350+
field: "\000"
351+
}
352+
353+
Mysqlx.Resultset.Row {
354+
field: "group_replication/status/role_change\000"
355+
field: "\000"
356+
}
357+
358+
Mysqlx.Resultset.Row {
359+
field: "group_replication/status/state_change\000"
360+
field: "\000"
361+
}
362+
343363
Mysqlx.Resultset.Row {
344364
field: "account_expired\000"
345365
field: "\002"

mysql-test/suite/x/r/notice_warning_mysqlx.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Warnings generated:
3939
WARNING | 1265 | Data truncated for column 'd' at row 1
4040
notice enabled
4141
warnings 1
42+
group_replication/membership/quorum_loss 0
43+
group_replication/membership/view 0
44+
group_replication/status/role_change 0
45+
group_replication/status/state_change 0
4246
account_expired 1
4347
generated_insert_id 1
4448
rows_affected 1

mysql-test/suite/x/r/notices_disable.result

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,6 +2713,7 @@ Mysqlx.Error {
27132713
expect Mysqlx_stmt_disable_notices=5 and remaining are 0
27142714
RUN show status like 'Mysqlx%notice%'
27152715
Variable_name Value
2716+
Mysqlx_notice_global_sent 0
27162717
Mysqlx_notice_other_sent 2
27172718
Mysqlx_notice_warning_sent 0
27182719
Mysqlx_stmt_disable_notices 5
@@ -2833,6 +2834,7 @@ Mysqlx.Error {
28332834
expect Mysqlx_stmt_disable_notices=5 and remaining are 0
28342835
RUN show status like 'Mysqlx%notice%'
28352836
Variable_name Value
2837+
Mysqlx_notice_global_sent 0
28362838
Mysqlx_notice_other_sent 2
28372839
Mysqlx_notice_warning_sent 0
28382840
Mysqlx_stmt_disable_notices 5
@@ -3167,6 +3169,26 @@ Mysqlx.Resultset.Row {
31673169
field: "\002"
31683170
}
31693171

3172+
Mysqlx.Resultset.Row {
3173+
field: "group_replication/membership/quorum_loss\000"
3174+
field: "\000"
3175+
}
3176+
3177+
Mysqlx.Resultset.Row {
3178+
field: "group_replication/membership/view\000"
3179+
field: "\000"
3180+
}
3181+
3182+
Mysqlx.Resultset.Row {
3183+
field: "group_replication/status/role_change\000"
3184+
field: "\000"
3185+
}
3186+
3187+
Mysqlx.Resultset.Row {
3188+
field: "group_replication/status/state_change\000"
3189+
field: "\000"
3190+
}
3191+
31703192
Mysqlx.Resultset.Row {
31713193
field: "account_expired\000"
31723194
field: "\002"
@@ -3281,6 +3303,26 @@ Mysqlx.Resultset.Row {
32813303
field: "\002"
32823304
}
32833305

3306+
Mysqlx.Resultset.Row {
3307+
field: "group_replication/membership/quorum_loss\000"
3308+
field: "\000"
3309+
}
3310+
3311+
Mysqlx.Resultset.Row {
3312+
field: "group_replication/membership/view\000"
3313+
field: "\000"
3314+
}
3315+
3316+
Mysqlx.Resultset.Row {
3317+
field: "group_replication/status/role_change\000"
3318+
field: "\000"
3319+
}
3320+
3321+
Mysqlx.Resultset.Row {
3322+
field: "group_replication/status/state_change\000"
3323+
field: "\000"
3324+
}
3325+
32843326
Mysqlx.Resultset.Row {
32853327
field: "account_expired\000"
32863328
field: "\002"

mysql-test/suite/x/r/notices_disable_mysqlx.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ Try Disable produced_message
409409
Got expected error: Cannot disable notice produced_message (code 5164)
410410
expect Mysqlx_stmt_disable_notices=5 and remaining are 0
411411
Variable_name Value
412+
Mysqlx_notice_global_sent 0
412413
Mysqlx_notice_other_sent 1
413414
Mysqlx_notice_warning_sent 0
414415
Mysqlx_stmt_disable_notices 5
@@ -433,6 +434,7 @@ Try Disable produced_message
433434
Got expected error: Cannot disable notice produced_message (code 5164)
434435
expect Mysqlx_stmt_disable_notices=5 and remaining are 0
435436
Variable_name Value
437+
Mysqlx_notice_global_sent 0
436438
Mysqlx_notice_other_sent 1
437439
Mysqlx_notice_warning_sent 0
438440
Mysqlx_stmt_disable_notices 5
@@ -542,6 +544,10 @@ expect error from account_expired onwards as it is read-only though warnings ret
542544
Got expected error: Cannot disable notice account_expired (code 5164)
543545
notice enabled
544546
warnings 1
547+
group_replication/membership/quorum_loss 0
548+
group_replication/membership/view 0
549+
group_replication/status/role_change 0
550+
group_replication/status/state_change 0
545551
account_expired 1
546552
generated_insert_id 1
547553
rows_affected 1
@@ -551,6 +557,10 @@ expect error as disabling account_expired returns error as expected since it is
551557
Got expected error: Cannot disable notice account_expired (code 5164)
552558
notice enabled
553559
warnings 1
560+
group_replication/membership/quorum_loss 0
561+
group_replication/membership/view 0
562+
group_replication/status/role_change 0
563+
group_replication/status/state_change 0
554564
account_expired 1
555565
generated_insert_id 1
556566
rows_affected 1

mysql-test/suite/x/r/notices_enable.result

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7810,8 +7810,9 @@ Mysqlx.Error {
78107810
0 rows affected
78117811

78127812
0 rows affected
7813-
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 37]
7813+
Verify [Status variable "Mysqlx_notice_global_sent" needs to have a value of 0]
78147814
Verify [Status variable "Mysqlx_notice_warning_sent" needs to have a value of 32]
7815+
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 39]
78157816
Verify [Status variable "Mysqlx_stmt_disable_notices" needs to have a value of 0]
78167817
Verify [Status variable "Mysqlx_stmt_enable_notices" needs to have a value of 0]
78177818
Verify [Status variable "Mysqlx_stmt_list_notices" needs to have a value of 0]
@@ -7839,8 +7840,9 @@ Try enable produced_message
78397840
Mysqlx.Sql.StmtExecuteOk {
78407841
}
78417842

7842-
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 2]
7843+
Verify [Status variable "Mysqlx_notice_global_sent" needs to have a value of 0]
78437844
Verify [Status variable "Mysqlx_notice_warning_sent" needs to have a value of 0]
7845+
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 4]
78447846
Verify [Status variable "Mysqlx_stmt_disable_notices" needs to have a value of 0]
78457847
Verify [Status variable "Mysqlx_stmt_enable_notices" needs to have a value of 5]
78467848
Verify [Status variable "Mysqlx_stmt_list_notices" needs to have a value of 0]
@@ -7869,8 +7871,9 @@ Try enable produced_message
78697871
Mysqlx.Sql.StmtExecuteOk {
78707872
}
78717873

7872-
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 2]
7874+
Verify [Status variable "Mysqlx_notice_global_sent" needs to have a value of 0]
78737875
Verify [Status variable "Mysqlx_notice_warning_sent" needs to have a value of 0]
7876+
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 4]
78747877
Verify [Status variable "Mysqlx_stmt_disable_notices" needs to have a value of 0]
78757878
Verify [Status variable "Mysqlx_stmt_enable_notices" needs to have a value of 5]
78767879
Verify [Status variable "Mysqlx_stmt_list_notices" needs to have a value of 0]
@@ -7907,6 +7910,26 @@ Mysqlx.Resultset.Row {
79077910
field: "\002"
79087911
}
79097912

7913+
Mysqlx.Resultset.Row {
7914+
field: "group_replication/membership/quorum_loss\000"
7915+
field: "\000"
7916+
}
7917+
7918+
Mysqlx.Resultset.Row {
7919+
field: "group_replication/membership/view\000"
7920+
field: "\000"
7921+
}
7922+
7923+
Mysqlx.Resultset.Row {
7924+
field: "group_replication/status/role_change\000"
7925+
field: "\000"
7926+
}
7927+
7928+
Mysqlx.Resultset.Row {
7929+
field: "group_replication/status/state_change\000"
7930+
field: "\000"
7931+
}
7932+
79107933
Mysqlx.Resultset.Row {
79117934
field: "account_expired\000"
79127935
field: "\002"
@@ -7933,8 +7956,9 @@ Mysqlx.Resultset.FetchDone {
79337956
Mysqlx.Sql.StmtExecuteOk {
79347957
}
79357958

7936-
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 2]
7959+
Verify [Status variable "Mysqlx_notice_global_sent" needs to have a value of 0]
79377960
Verify [Status variable "Mysqlx_notice_warning_sent" needs to have a value of 0]
7961+
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 4]
79387962
Verify [Status variable "Mysqlx_stmt_disable_notices" needs to have a value of 0]
79397963
Verify [Status variable "Mysqlx_stmt_enable_notices" needs to have a value of 1]
79407964
Verify [Status variable "Mysqlx_stmt_list_notices" needs to have a value of 1]
@@ -7997,6 +8021,26 @@ Mysqlx.Resultset.Row {
79978021
field: "\002"
79988022
}
79998023

8024+
Mysqlx.Resultset.Row {
8025+
field: "group_replication/membership/quorum_loss\000"
8026+
field: "\000"
8027+
}
8028+
8029+
Mysqlx.Resultset.Row {
8030+
field: "group_replication/membership/view\000"
8031+
field: "\000"
8032+
}
8033+
8034+
Mysqlx.Resultset.Row {
8035+
field: "group_replication/status/role_change\000"
8036+
field: "\000"
8037+
}
8038+
8039+
Mysqlx.Resultset.Row {
8040+
field: "group_replication/status/state_change\000"
8041+
field: "\000"
8042+
}
8043+
80008044
Mysqlx.Resultset.Row {
80018045
field: "account_expired\000"
80028046
field: "\002"
@@ -8049,6 +8093,26 @@ Mysqlx.Resultset.Row {
80498093
field: "\002"
80508094
}
80518095

8096+
Mysqlx.Resultset.Row {
8097+
field: "group_replication/membership/quorum_loss\000"
8098+
field: "\000"
8099+
}
8100+
8101+
Mysqlx.Resultset.Row {
8102+
field: "group_replication/membership/view\000"
8103+
field: "\000"
8104+
}
8105+
8106+
Mysqlx.Resultset.Row {
8107+
field: "group_replication/status/role_change\000"
8108+
field: "\000"
8109+
}
8110+
8111+
Mysqlx.Resultset.Row {
8112+
field: "group_replication/status/state_change\000"
8113+
field: "\000"
8114+
}
8115+
80528116
Mysqlx.Resultset.Row {
80538117
field: "account_expired\000"
80548118
field: "\002"
@@ -8075,8 +8139,9 @@ Mysqlx.Resultset.FetchDone {
80758139
Mysqlx.Sql.StmtExecuteOk {
80768140
}
80778141

8078-
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 4]
8142+
Verify [Status variable "Mysqlx_notice_global_sent" needs to have a value of 0]
80798143
Verify [Status variable "Mysqlx_notice_warning_sent" needs to have a value of 1]
8144+
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 6]
80808145
Verify [Status variable "Mysqlx_stmt_disable_notices" needs to have a value of 1]
80818146
Verify [Status variable "Mysqlx_stmt_enable_notices" needs to have a value of 2]
80828147
Verify [Status variable "Mysqlx_stmt_list_notices" needs to have a value of 2]
@@ -8102,8 +8167,9 @@ Mysqlx.Notice.Frame {
81028167
Mysqlx.Sql.StmtExecuteOk {
81038168
}
81048169

8105-
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 3]
8170+
Verify [Status variable "Mysqlx_notice_global_sent" needs to have a value of 0]
81068171
Verify [Status variable "Mysqlx_notice_warning_sent" needs to have a value of 1]
8172+
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 5]
81078173
Verify [Status variable "Mysqlx_stmt_disable_notices" needs to have a value of 0]
81088174
Verify [Status variable "Mysqlx_stmt_enable_notices" needs to have a value of 0]
81098175
Verify [Status variable "Mysqlx_stmt_list_notices" needs to have a value of 0]
@@ -8122,8 +8188,9 @@ Mysqlx.Error {
81228188
sql_state: "3D000"
81238189
}
81248190

8125-
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 1]
8191+
Verify [Status variable "Mysqlx_notice_global_sent" needs to have a value of 0]
81268192
Verify [Status variable "Mysqlx_notice_warning_sent" needs to have a value of 0]
8193+
Verify [Status variable "Mysqlx_notice_other_sent" needs to have a value of 3]
81278194
Verify [Status variable "Mysqlx_stmt_disable_notices" needs to have a value of 0]
81288195
Verify [Status variable "Mysqlx_stmt_enable_notices" needs to have a value of 0]
81298196
Verify [Status variable "Mysqlx_stmt_list_notices" needs to have a value of 0]

0 commit comments

Comments
 (0)