summaryrefslogtreecommitdiff
path: root/mysql-test/suite/perfschema/t/connection_type_notwin.test
blob: 800fdb7ad51e01a90972c2ef76838952a8b35cc4 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

--source include/not_windows.inc
--source include/not_embedded.inc
--source include/have_debug.inc
--source include/have_perfschema.inc

--echo "Default connection"

--vertical_results
select NAME, PROCESSLIST_USER, PROCESSLIST_HOST, CONNECTION_TYPE
  from performance_schema.threads
  where PROCESSLIST_ID = connection_id();

create user 'root'@'santa.claus.ipv4.example.com';
grant select on *.* to 'root'@'santa.claus.ipv4.example.com';
create user 'rootssl'@'santa.claus.ipv4.example.com'
  require SSL;
grant select on *.* to 'rootssl'@'santa.claus.ipv4.example.com';

set @old_dbug=@@global.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";

# Setup
# make sure we start with a clean slate. log_tables.test says this is OK.
TRUNCATE TABLE mysql.general_log;

SET @old_log_output=          @@global.log_output;
SET @old_general_log=         @@global.general_log;
SET @old_general_log_file=    @@global.general_log_file;

--replace_result $MYSQLTEST_VARDIR ...
eval SET GLOBAL general_log_file = '$MYSQLTEST_VARDIR/log/rewrite_general_con.log';
SET GLOBAL log_output =       'FILE,TABLE';
SET GLOBAL general_log=       'ON';

connect(con1, localhost, root,,);

--echo "Connection con1"

select NAME, PROCESSLIST_USER, PROCESSLIST_HOST, CONNECTION_TYPE
  from performance_schema.threads
  where PROCESSLIST_ID = connection_id();

--disconnect con1

connect(con2, "127.0.0.1", root,,test,$MASTER_MYPORT,);

--echo "Connection con2"

select NAME, PROCESSLIST_USER, PROCESSLIST_HOST, CONNECTION_TYPE
  from performance_schema.threads
  where PROCESSLIST_ID = connection_id();

--disconnect con2

connect(con3, "127.0.0.1", rootssl,,test,$MASTER_MYPORT,,SSL);

--echo "Connection con3"

select NAME, PROCESSLIST_USER, PROCESSLIST_HOST, CONNECTION_TYPE
  from performance_schema.threads
  where PROCESSLIST_ID = connection_id();

--disconnect con3

--connection default

SET GLOBAL general_log=       'OFF';

# show general-logging to file is correct
CREATE TABLE test_log (argument TEXT);
--replace_result $MYSQLTEST_VARDIR ...
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/log/rewrite_general_con.log'
     INTO TABLE test_log FIELDS TERMINATED BY '\n' LINES TERMINATED BY '\n';

select user_host, command_type, argument from mysql.general_log
  where command_type = "Connect";

select substring(argument, locate("Connect", argument)) from test_log
  where argument like "%Connect%on test%";


DROP TABLE test_log;

--remove_file $MYSQLTEST_VARDIR/log/rewrite_general_con.log

SET GLOBAL general_log_file=  @old_general_log_file;
SET GLOBAL general_log=       @old_general_log;
SET GLOBAL log_output=        @old_log_output;

--horizontal_results

set global debug_dbug= @old_dbug;
revoke select on *.* from 'root'@'santa.claus.ipv4.example.com';
drop user 'root'@'santa.claus.ipv4.example.com';
revoke select on *.* from 'rootssl'@'santa.claus.ipv4.example.com';
drop user 'rootssl'@'santa.claus.ipv4.example.com';