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
|