11 changed files with 357 additions and 53 deletions
-
20mysql-test/suite/perfschema/r/show_coverage.result
-
32mysql-test/suite/perfschema/r/show_plugin.result
-
154mysql-test/suite/perfschema/r/variables_by_thread.result
-
22mysql-test/suite/perfschema/t/show_coverage.test
-
8mysql-test/suite/perfschema/t/show_plugin.test
-
4mysql-test/suite/perfschema/t/variables_by_thread.combinations
-
157mysql-test/suite/perfschema/t/variables_by_thread.test
-
2sql/my_apc.cc
-
1sql/sql_class.cc
-
5sql/sql_parse.cc
-
5storage/perfschema/pfs_variable.cc
@ -0,0 +1,154 @@ |
|||
# |
|||
# Results from inactive connections are shown |
|||
# |
|||
SET time_zone= '+2:00'; |
|||
SELECT THREAD_ID INTO @def_thread_id FROM performance_schema.threads |
|||
WHERE PROCESSLIST_ID = CONNECTION_ID(); |
|||
connect con2, localhost, root,,; |
|||
connect con1, localhost, root,,; |
|||
set time_zone= '+10:00'; |
|||
SELECT THREAD_ID INTO @con1_thread_id FROM performance_schema.threads |
|||
WHERE PROCESSLIST_ID = CONNECTION_ID(); |
|||
SELECT thread_id = @con1_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
current variable_value |
|||
0 +02:00 |
|||
0 SYSTEM |
|||
1 +10:00 |
|||
connection con2; |
|||
connection default; |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
current variable_value |
|||
1 +02:00 |
|||
0 SYSTEM |
|||
0 +10:00 |
|||
# |
|||
# Notify APC before net_read |
|||
# |
|||
connection con2; |
|||
select "good"; |
|||
good |
|||
good |
|||
connection con1; |
|||
set debug_sync= "before_do_command_net_read SIGNAL net WAIT_FOR pass"; |
|||
connection default; |
|||
set debug_sync= "now WAIT_FOR net"; |
|||
set debug_sync= "apc_after_notify SIGNAL pass"; |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
current variable_value |
|||
1 +02:00 |
|||
0 SYSTEM |
|||
0 +10:00 |
|||
set debug_sync= "now SIGNAL pass"; |
|||
connection con1; |
|||
connection default; |
|||
# |
|||
# Test timeout |
|||
# |
|||
set @old_dbug= @@global.debug_dbug; |
|||
set global debug_dbug= "+d,apc_timeout"; |
|||
connection con2; |
|||
select "good"; |
|||
good |
|||
good |
|||
connection con1; |
|||
set debug_sync= "now SIGNAL waiting WAIT_FOR pass"; |
|||
connection default; |
|||
set debug_sync= "now WAIT_FOR waiting"; |
|||
# Should timeout in 1ms. |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone" |
|||
and thread_id in (@def_thread_id, |
|||
@con1_thread_id); |
|||
current variable_value |
|||
1 +02:00 |
|||
set debug_sync= "now SIGNAL pass"; |
|||
connection con1; |
|||
SELECT "ok"; |
|||
ok |
|||
ok |
|||
connection con2; |
|||
select "good"; |
|||
good |
|||
good |
|||
connection default; |
|||
set global debug_dbug= @old_dbug; |
|||
# |
|||
# Two requests |
|||
# |
|||
connection con1; |
|||
set debug_sync= "before_do_command_net_read SIGNAL net WAIT_FOR pass"; |
|||
SELECT "work"; |
|||
connection con2; |
|||
set debug_sync= "now WAIT_FOR net"; |
|||
set debug_sync= "apc_after_notify SIGNAL con2_hangs"; |
|||
SELECT thread_id = @con1_thread_id as `con1's`, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
connection default; |
|||
set debug_sync= "now WAIT_FOR con2_hangs"; |
|||
set debug_sync= "apc_after_notify SIGNAL pass"; |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
current variable_value |
|||
1 +02:00 |
|||
0 SYSTEM |
|||
0 +10:00 |
|||
connection con1; |
|||
work |
|||
work |
|||
connection con2; |
|||
con1's variable_value |
|||
0 +02:00 |
|||
0 SYSTEM |
|||
1 +10:00 |
|||
select "good"; |
|||
good |
|||
good |
|||
# |
|||
# Result from the killed query is shown. |
|||
# |
|||
connection con1; |
|||
set debug_sync= "after_dispatch_command SIGNAL dispatched WAIT_FOR pass"; |
|||
SELECT "work"; |
|||
connection default; |
|||
set debug_sync= "now WAIT_FOR dispatched"; |
|||
KILL QUERY @con1_kill_thread_id; |
|||
connection default; |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
current variable_value |
|||
1 +02:00 |
|||
0 SYSTEM |
|||
0 +10:00 |
|||
set debug_sync= "now SIGNAL pass"; |
|||
# |
|||
# Result from the killed connection is ignored. |
|||
# |
|||
connection con1; |
|||
work |
|||
work |
|||
set debug_sync= "after_dispatch_command SIGNAL dispatched WAIT_FOR pass"; |
|||
SELECT "work"; |
|||
connection default; |
|||
set debug_sync= "now WAIT_FOR dispatched"; |
|||
KILL CONNECTION @con1_kill_thread_id; |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
current variable_value |
|||
1 +02:00 |
|||
0 SYSTEM |
|||
# Cleanup |
|||
connection default; |
|||
set debug_sync= "reset"; |
|||
disconnect con1; |
|||
disconnect con2; |
@ -0,0 +1,4 @@ |
|||
[thread-per-connection] |
|||
thread-handling=one-thread-per-connection |
|||
[tpool] |
|||
thread-handling=pool-of-threads |
@ -0,0 +1,157 @@ |
|||
--source include/have_perfschema.inc |
|||
--source include/have_debug_sync.inc |
|||
--source include/not_embedded.inc |
|||
|
|||
--echo # |
|||
--echo # Results from inactive connections are shown |
|||
--echo # |
|||
SET time_zone= '+2:00'; |
|||
|
|||
SELECT THREAD_ID INTO @def_thread_id FROM performance_schema.threads |
|||
WHERE PROCESSLIST_ID = CONNECTION_ID(); |
|||
|
|||
--connect (con2, localhost, root,,) |
|||
--connect (con1, localhost, root,,) |
|||
set time_zone= '+10:00'; |
|||
|
|||
SELECT THREAD_ID INTO @con1_thread_id FROM performance_schema.threads |
|||
WHERE PROCESSLIST_ID = CONNECTION_ID(); |
|||
|
|||
let $con1_thread_id= `select @con1_thread_id`; |
|||
let $con1_kill_thread_id= `select CONNECTION_ID()`; |
|||
|
|||
SELECT thread_id = @con1_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
|
|||
--connection con2 |
|||
--disable_query_log |
|||
eval set @con1_thread_id= $con1_thread_id; |
|||
eval set @con1_kill_thread_id= $con1_kill_thread_id; |
|||
--enable_query_log |
|||
|
|||
--connection default |
|||
--disable_query_log |
|||
eval set @con1_thread_id= $con1_thread_id; |
|||
eval set @con1_kill_thread_id= $con1_kill_thread_id; |
|||
--enable_query_log |
|||
|
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
|
|||
--echo # |
|||
--echo # Notify APC before net_read |
|||
--echo # |
|||
--connection con2 |
|||
select "good"; |
|||
--connection con1 |
|||
--send |
|||
set debug_sync= "before_do_command_net_read SIGNAL net WAIT_FOR pass"; |
|||
--connection default |
|||
set debug_sync= "now WAIT_FOR net"; |
|||
set debug_sync= "apc_after_notify SIGNAL pass"; |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
|
|||
set debug_sync= "now SIGNAL pass"; |
|||
--connection con1 |
|||
--reap |
|||
--connection default |
|||
|
|||
--echo # |
|||
--echo # Test timeout |
|||
--echo # |
|||
set @old_dbug= @@global.debug_dbug; |
|||
set global debug_dbug= "+d,apc_timeout"; |
|||
--connection con2 |
|||
select "good"; |
|||
--connection con1 |
|||
--send |
|||
set debug_sync= "now SIGNAL waiting WAIT_FOR pass"; |
|||
--connection default |
|||
set debug_sync= "now WAIT_FOR waiting"; |
|||
--echo # Should timeout in 1ms. |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone" |
|||
and thread_id in (@def_thread_id, |
|||
@con1_thread_id); # con2 can be nondeterministically skipped |
|||
set debug_sync= "now SIGNAL pass"; |
|||
--connection con1 |
|||
--reap |
|||
SELECT "ok"; |
|||
--connection con2 |
|||
select "good"; |
|||
--connection default |
|||
set global debug_dbug= @old_dbug; |
|||
|
|||
--echo # |
|||
--echo # Two requests |
|||
--echo # |
|||
|
|||
--connection con1 |
|||
set debug_sync= "before_do_command_net_read SIGNAL net WAIT_FOR pass"; |
|||
--send |
|||
SELECT "work"; |
|||
--connection con2 |
|||
set debug_sync= "now WAIT_FOR net"; |
|||
set debug_sync= "apc_after_notify SIGNAL con2_hangs"; |
|||
--send |
|||
SELECT thread_id = @con1_thread_id as `con1's`, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
--connection default |
|||
set debug_sync= "now WAIT_FOR con2_hangs"; |
|||
set debug_sync= "apc_after_notify SIGNAL pass"; |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
|
|||
--connection con1 |
|||
--reap |
|||
--connection con2 |
|||
--reap |
|||
select "good"; |
|||
|
|||
--echo # |
|||
--echo # Result from the killed query is shown. |
|||
--echo # |
|||
|
|||
--connection con1 |
|||
set debug_sync= "after_dispatch_command SIGNAL dispatched WAIT_FOR pass"; |
|||
--send |
|||
SELECT "work"; |
|||
--connection default |
|||
set debug_sync= "now WAIT_FOR dispatched"; |
|||
KILL QUERY @con1_kill_thread_id; |
|||
--connection default |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
|
|||
set debug_sync= "now SIGNAL pass"; |
|||
|
|||
--echo # |
|||
--echo # Result from the killed connection is ignored. |
|||
--echo # |
|||
|
|||
--connection con1 |
|||
--reap |
|||
set debug_sync= "after_dispatch_command SIGNAL dispatched WAIT_FOR pass"; |
|||
--send |
|||
SELECT "work"; |
|||
--connection default |
|||
set debug_sync= "now WAIT_FOR dispatched"; |
|||
KILL CONNECTION @con1_kill_thread_id; |
|||
SELECT thread_id = @def_thread_id as current, variable_value |
|||
FROM performance_schema.variables_by_thread |
|||
WHERE variable_name = "time_zone"; |
|||
|
|||
|
|||
--echo # Cleanup |
|||
--connection default |
|||
set debug_sync= "reset"; |
|||
--disconnect con1 |
|||
--disconnect con2 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue