File: rpl_connect_attr.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (66 lines) | stat: -rw-r--r-- 2,421 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# ==== Purpose ====
#
# Verify that replication clients (mysqld replication slave or
# mysqlbinlog --stop-never) set the required client attributes.
#
# ====  Implementation ====
#
# Start the client, then SELECT from performance_schema.session_connect_attrs.
#
# ==== References ====
#
# BUG#16555723: REPLICATION CONNECTION SHOULD SET PROGRAM_NAME ATTRIBUTE
 
# Uses /dev/null
--source include/not_windows.inc
 
--source include/master-slave.inc
 
--echo ==== Case 1: slave connection ====
 
# Get thread id of dump thread.
--let $thread_id= `SELECT PROCESSLIST_ID FROM performance_schema.threads WHERE PROCESSLIST_COMMAND = 'Binlog Dump'`
 
# Show connection attributes
--replace_result $thread_id <thread_id>
eval SELECT ATTR_NAME, ATTR_VALUE FROM performance_schema.session_connect_attrs
   WHERE PROCESSLIST_ID = $thread_id AND
   ATTR_NAME IN ('program_name', '_client_replication_channel_name', '_client_role');
 
--echo ==== Case 2: mysqlbinlog connection ====
 
# Stop slave so as not to mix client attrs from slave with client
# attrs from mysqlbinlog.
--source include/rpl_connection_slave.inc
--source include/stop_slave.inc
--source include/rpl_connection_master.inc
--source include/stop_dump_threads.inc
 
--echo # Start mysqlbinlog
--let BINLOG_FILE= query_get_value(SHOW MASTER STATUS, File, 1)
perl;
  my $mysqlbinlog= $ENV{'MYSQL_BINLOG'};
  my $port= $ENV{'MASTER_MYPORT'};
  my $binlog_file= $ENV{'BINLOG_FILE'};
  system("$mysqlbinlog --stop-never --read-from-remote-server --user=root --host=127.0.0.1 --port=$port $binlog_file > /dev/null &");
EOF
 
# Wait for master threads to start
--let $wait_condition= SELECT COUNT(*) > 0 FROM performance_schema.threads WHERE PROCESSLIST_COMMAND LIKE 'Binlog Dump' AND PROCESSLIST_STATE LIKE '%Source has sent%';
--source include/wait_condition.inc
 
# Get thread id of dump thread.
--let $thread_id= `SELECT PROCESSLIST_ID FROM performance_schema.threads WHERE PROCESSLIST_COMMAND = 'Binlog Dump'`
 
# Show connection attributes
--replace_result $thread_id <thread_id>
eval SELECT ATTR_NAME, ATTR_VALUE FROM performance_schema.session_connect_attrs
   WHERE PROCESSLIST_ID = $thread_id AND
   ATTR_NAME IN ('program_name', '_client_replication_channel_name', '_client_role');
 
# Clean up. This will cause mysqlbinlog to exit.
--replace_result $thread_id <thread_id>
eval KILL $thread_id;
 
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc