Commit 7dd137c4 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-6756: map a linux pid (child pid) to a connection id shown in the output of SHOW PROCESSLIST

Added tid (thread ID) for system where it is present.

 ps -eL -o tid,pid,command

shows the thread on Linux
parent d9b25ae3
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
#cmakedefine HAVE_SYS_UTSNAME_H 1 #cmakedefine HAVE_SYS_UTSNAME_H 1
#cmakedefine HAVE_SYS_STAT_H 1 #cmakedefine HAVE_SYS_STAT_H 1
#cmakedefine HAVE_SYS_STREAM_H 1 #cmakedefine HAVE_SYS_STREAM_H 1
#cmakedefine HAVE_SYS_SYSCALL_H 1
#cmakedefine HAVE_SYS_TERMCAP_H 1 #cmakedefine HAVE_SYS_TERMCAP_H 1
#cmakedefine HAVE_SYS_TIMEB_H 1 #cmakedefine HAVE_SYS_TIMEB_H 1
#cmakedefine HAVE_SYS_TIMES_H 1 #cmakedefine HAVE_SYS_TIMES_H 1
......
...@@ -228,6 +228,7 @@ CHECK_INCLUDE_FILES ("sys/types.h;sys/shm.h" HAVE_SYS_SHM_H) ...@@ -228,6 +228,7 @@ CHECK_INCLUDE_FILES ("sys/types.h;sys/shm.h" HAVE_SYS_SHM_H)
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H) CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H) CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H) CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
CHECK_INCLUDE_FILES (sys/syscall.h HAVE_SYS_SYSCALL_H)
CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H) CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H)
CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H) CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H) CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H)
......
...@@ -1926,7 +1926,8 @@ t1 CREATE TABLE `t1` ( ...@@ -1926,7 +1926,8 @@ t1 CREATE TABLE `t1` (
`MEMORY_USED` int(7) NOT NULL DEFAULT '0', `MEMORY_USED` int(7) NOT NULL DEFAULT '0',
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0', `EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0',
`QUERY_ID` bigint(4) NOT NULL DEFAULT '0', `QUERY_ID` bigint(4) NOT NULL DEFAULT '0',
`INFO_BINARY` blob `INFO_BINARY` blob,
`TID` bigint(4) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8 ) DEFAULT CHARSET=utf8
drop table t1; drop table t1;
create temporary table t1 like information_schema.processlist; create temporary table t1 like information_schema.processlist;
...@@ -1948,7 +1949,8 @@ t1 CREATE TEMPORARY TABLE `t1` ( ...@@ -1948,7 +1949,8 @@ t1 CREATE TEMPORARY TABLE `t1` (
`MEMORY_USED` int(7) NOT NULL DEFAULT '0', `MEMORY_USED` int(7) NOT NULL DEFAULT '0',
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0', `EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0',
`QUERY_ID` bigint(4) NOT NULL DEFAULT '0', `QUERY_ID` bigint(4) NOT NULL DEFAULT '0',
`INFO_BINARY` blob `INFO_BINARY` blob,
`TID` bigint(4) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8 ) DEFAULT CHARSET=utf8
drop table t1; drop table t1;
create table t1 like information_schema.character_sets; create table t1 like information_schema.character_sets;
......
#
# MDEV-6756: map a linux pid (child pid) to a connection id shown in
# the output of SHOW PROCESSLIST
#
SELECT max(tid) != min(tid) FROM information_schema.processlist;
max(tid) != min(tid)
1
...@@ -48,9 +48,9 @@ eval INSERT INTO $table SELECT * FROM test.t_$table; ...@@ -48,9 +48,9 @@ eval INSERT INTO $table SELECT * FROM test.t_$table;
eval DROP TABLE test.t_$table; eval DROP TABLE test.t_$table;
--error ER_VIEW_NONUPD_CHECK --error ER_VIEW_NONUPD_CHECK
eval CREATE VIEW test.v_$table ($columns) AS SELECT * FROM $table WITH CHECK OPTION; eval CREATE VIEW test.v_$table ($columns) AS SELECT $columns FROM $table WITH CHECK OPTION;
eval CREATE VIEW test.v_$table ($columns) AS SELECT * FROM $table; eval CREATE VIEW test.v_$table ($columns) AS SELECT $columns FROM $table;
# !!! This query returns a wrong error due to a bug in the code of mwl106 # !!! This query returns a wrong error due to a bug in the code of mwl106
# !!! Uncomment it when the bug is fixed # !!! Uncomment it when the bug is fixed
......
...@@ -158,9 +158,9 @@ WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1 ...@@ -158,9 +158,9 @@ WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1
eval SHOW CREATE TABLE $table; eval SHOW CREATE TABLE $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
eval SHOW $table; eval SHOW $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
eval SELECT * FROM $table $select_where ORDER BY id; eval SELECT * FROM $table $select_where ORDER BY id;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
eval SELECT $columns FROM $table $select_where ORDER BY id; eval SELECT $columns FROM $table $select_where ORDER BY id;
--source suite/funcs_1/datadict/datadict_priv.inc --source suite/funcs_1/datadict/datadict_priv.inc
--real_sleep 0.3 --real_sleep 0.3
...@@ -178,9 +178,9 @@ connection con100; ...@@ -178,9 +178,9 @@ connection con100;
eval SHOW CREATE TABLE $table; eval SHOW CREATE TABLE $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
eval SHOW $table; eval SHOW $table;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
eval SELECT * FROM $table $select_where ORDER BY id; eval SELECT * FROM $table $select_where ORDER BY id;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
eval SELECT $columns FROM $table $select_where ORDER BY id; eval SELECT $columns FROM $table $select_where ORDER BY id;
--source suite/funcs_1/datadict/datadict_priv.inc --source suite/funcs_1/datadict/datadict_priv.inc
--real_sleep 0.3 --real_sleep 0.3
...@@ -204,7 +204,7 @@ connection con100; ...@@ -204,7 +204,7 @@ connection con100;
SHOW GRANTS; SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -216,7 +216,7 @@ connect (con101,localhost,ddicttestuser1,ddictpass,information_schema); ...@@ -216,7 +216,7 @@ connect (con101,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS; SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -239,7 +239,7 @@ connect (anonymous1,localhost,"''",,information_schema); ...@@ -239,7 +239,7 @@ connect (anonymous1,localhost,"''",,information_schema);
SHOW GRANTS; SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -261,7 +261,7 @@ connect (con102,localhost,ddicttestuser1,ddictpass,information_schema); ...@@ -261,7 +261,7 @@ connect (con102,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS; SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -287,7 +287,7 @@ if ($fixed_bug_30395) ...@@ -287,7 +287,7 @@ if ($fixed_bug_30395)
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
} }
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -308,7 +308,7 @@ connect (con103,localhost,ddicttestuser1,ddictpass,information_schema); ...@@ -308,7 +308,7 @@ connect (con103,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -330,7 +330,7 @@ connect (con104,localhost,ddicttestuser1,ddictpass,information_schema); ...@@ -330,7 +330,7 @@ connect (con104,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -377,7 +377,7 @@ connect (con200,localhost,ddicttestuser2,ddictpass,information_schema); ...@@ -377,7 +377,7 @@ connect (con200,localhost,ddicttestuser2,ddictpass,information_schema);
SHOW GRANTS FOR 'ddicttestuser2'@'localhost'; SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -398,7 +398,7 @@ connect (con201,localhost,ddicttestuser2,ddictpass,information_schema); ...@@ -398,7 +398,7 @@ connect (con201,localhost,ddicttestuser2,ddictpass,information_schema);
SHOW GRANTS; SHOW GRANTS;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -421,7 +421,7 @@ SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; ...@@ -421,7 +421,7 @@ SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
...@@ -445,7 +445,7 @@ connect (con108,localhost,ddicttestuser1,ddictpass,information_schema); ...@@ -445,7 +445,7 @@ connect (con108,localhost,ddicttestuser1,ddictpass,information_schema);
SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS
SHOW processlist; SHOW processlist;
--replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID --replace_column 1 ID 3 HOST_NAME 6 TIME 9 TIME_MS 13 MEMORY 14 ROWS 15 QUERY_ID 17 TID
SELECT * FROM information_schema.processlist; SELECT * FROM information_schema.processlist;
--real_sleep 0.3 --real_sleep 0.3
......
...@@ -92,7 +92,7 @@ echo ...@@ -92,7 +92,7 @@ echo
# - INFO must contain the corresponding SHOW/SELECT PROCESSLIST # - INFO must contain the corresponding SHOW/SELECT PROCESSLIST
# #
# 1. Just dump what we get # 1. Just dump what we get
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS>
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
...@@ -165,7 +165,7 @@ let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST ...@@ -165,7 +165,7 @@ let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE COMMAND = 'Sleep' AND USER = 'test_user'; WHERE COMMAND = 'Sleep' AND USER = 'test_user';
--source include/wait_condition.inc --source include/wait_condition.inc
# 1. Just dump what we get # 1. Just dump what we get
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
...@@ -210,7 +210,7 @@ echo ...@@ -210,7 +210,7 @@ echo
# ----- switch to connection con1 (user = test_user) ----- # ----- switch to connection con1 (user = test_user) -----
; ;
connection con1; connection con1;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
...@@ -244,7 +244,7 @@ echo ...@@ -244,7 +244,7 @@ echo
; ;
connection con2; connection con2;
# Just dump what we get # Just dump what we get
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
...@@ -304,7 +304,7 @@ WHERE ID = @test_user_con2_id AND Command IN('Query','Execute') ...@@ -304,7 +304,7 @@ WHERE ID = @test_user_con2_id AND Command IN('Query','Execute')
AND State = 'User sleep' AND INFO IS NOT NULL ; AND State = 'User sleep' AND INFO IS NOT NULL ;
--source include/wait_condition.inc --source include/wait_condition.inc
# 1. Just dump what we get # 1. Just dump what we get
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
...@@ -375,7 +375,7 @@ let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST ...@@ -375,7 +375,7 @@ let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
# #
# Expect to see the state 'Waiting for table metadata lock' for the third # Expect to see the state 'Waiting for table metadata lock' for the third
# connection because the SELECT collides with the WRITE TABLE LOCK. # connection because the SELECT collides with the WRITE TABLE LOCK.
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> --replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
UNLOCK TABLES; UNLOCK TABLES;
# #
...@@ -434,7 +434,7 @@ echo ...@@ -434,7 +434,7 @@ echo
# SHOW FULL PROCESSLIST Complete statement # SHOW FULL PROCESSLIST Complete statement
# SHOW PROCESSLIST statement truncated after 100 char # SHOW PROCESSLIST statement truncated after 100 char
; ;
--replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> --replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE> --replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE>
SHOW FULL PROCESSLIST; SHOW FULL PROCESSLIST;
......
...@@ -265,6 +265,7 @@ def information_schema PROCESSLIST PROGRESS 12 0.000 NO decimal NULL NULL 7 3 NU ...@@ -265,6 +265,7 @@ def information_schema PROCESSLIST PROGRESS 12 0.000 NO decimal NULL NULL 7 3 NU
def information_schema PROCESSLIST QUERY_ID 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select def information_schema PROCESSLIST QUERY_ID 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select
def information_schema PROCESSLIST STAGE 10 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select def information_schema PROCESSLIST STAGE 10 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select
def information_schema PROCESSLIST STATE 7 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema PROCESSLIST STATE 7 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PROCESSLIST TID 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(4) select
def information_schema PROCESSLIST TIME 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) select def information_schema PROCESSLIST TIME 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) select
def information_schema PROCESSLIST TIME_MS 9 0.000 NO decimal NULL NULL 22 3 NULL NULL NULL decimal(22,3) select def information_schema PROCESSLIST TIME_MS 9 0.000 NO decimal NULL NULL 22 3 NULL NULL NULL decimal(22,3) select
def information_schema PROCESSLIST USER 2 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select def information_schema PROCESSLIST USER 2 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select
...@@ -795,6 +796,7 @@ NULL information_schema PROCESSLIST MEMORY_USED int NULL NULL NULL NULL int(7) ...@@ -795,6 +796,7 @@ NULL information_schema PROCESSLIST MEMORY_USED int NULL NULL NULL NULL int(7)
NULL information_schema PROCESSLIST EXAMINED_ROWS int NULL NULL NULL NULL int(7) NULL information_schema PROCESSLIST EXAMINED_ROWS int NULL NULL NULL NULL int(7)
NULL information_schema PROCESSLIST QUERY_ID bigint NULL NULL NULL NULL bigint(4) NULL information_schema PROCESSLIST QUERY_ID bigint NULL NULL NULL NULL bigint(4)
1.0000 information_schema PROCESSLIST INFO_BINARY blob 65535 65535 NULL NULL blob 1.0000 information_schema PROCESSLIST INFO_BINARY blob 65535 65535 NULL NULL blob
NULL information_schema PROCESSLIST TID bigint NULL NULL NULL NULL bigint(4)
3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
......
--source include/linux.inc
--echo #
--echo # MDEV-6756: map a linux pid (child pid) to a connection id shown in
--echo # the output of SHOW PROCESSLIST
--echo #
--connect (con1,localhost,root)
SELECT max(tid) != min(tid) FROM information_schema.processlist;
--connection default
--disconnect con1
...@@ -69,6 +69,10 @@ ...@@ -69,6 +69,10 @@
#include "sql_connect.h" #include "sql_connect.h"
#include "my_atomic.h" #include "my_atomic.h"
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
/* /*
The following is used to initialise Table_ident with a internal The following is used to initialise Table_ident with a internal
table name table name
...@@ -867,6 +871,7 @@ THD::THD(bool is_wsrep_applier) ...@@ -867,6 +871,7 @@ THD::THD(bool is_wsrep_applier)
m_statement_psi(NULL), m_statement_psi(NULL),
m_idle_psi(NULL), m_idle_psi(NULL),
thread_id(0), thread_id(0),
os_thread_id(0),
global_disable_checkpoint(0), global_disable_checkpoint(0),
failed_com_change_user(0), failed_com_change_user(0),
is_fatal_error(0), is_fatal_error(0),
...@@ -2067,6 +2072,11 @@ bool THD::store_globals() ...@@ -2067,6 +2072,11 @@ bool THD::store_globals()
This allows us to move THD to different threads if needed. This allows us to move THD to different threads if needed.
*/ */
mysys_var->id= thread_id; mysys_var->id= thread_id;
#ifdef __NR_gettid
os_thread_id= syscall(__NR_gettid);
#else
os_thread_id= 0;
#endif
real_id= pthread_self(); // For debugging real_id= pthread_self(); // For debugging
mysys_var->stack_ends_here= thread_stack + // for consistency, see libevent_thread_proc mysys_var->stack_ends_here= thread_stack + // for consistency, see libevent_thread_proc
STACK_DIRECTION * (long)my_thread_stack_size; STACK_DIRECTION * (long)my_thread_stack_size;
......
...@@ -2630,6 +2630,7 @@ class THD :public Statement, ...@@ -2630,6 +2630,7 @@ class THD :public Statement,
ulong query_plan_fsort_passes; ulong query_plan_fsort_passes;
pthread_t real_id; /* For debugging */ pthread_t real_id; /* For debugging */
my_thread_id thread_id; my_thread_id thread_id;
pid_t os_thread_id;
uint tmp_table, global_disable_checkpoint; uint tmp_table, global_disable_checkpoint;
uint server_status,open_options; uint server_status,open_options;
enum enum_thread_type system_thread; enum enum_thread_type system_thread;
......
...@@ -2334,6 +2334,7 @@ class thread_info :public ilink { ...@@ -2334,6 +2334,7 @@ class thread_info :public ilink {
{ TRASH(ptr, size); } { TRASH(ptr, size); }
ulong thread_id; ulong thread_id;
ulong os_thread_id;
ulonglong start_time; ulonglong start_time;
uint command; uint command;
const char *user,*host,*db,*proc_info,*state_info; const char *user,*host,*db,*proc_info,*state_info;
...@@ -2435,6 +2436,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) ...@@ -2435,6 +2436,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thread_info *thd_info= new (thd->mem_root) thread_info; thread_info *thd_info= new (thd->mem_root) thread_info;
thd_info->thread_id=tmp->thread_id; thd_info->thread_id=tmp->thread_id;
thd_info->os_thread_id=tmp->os_thread_id;
thd_info->user= thd->strdup(tmp_sctx->user ? tmp_sctx->user : thd_info->user= thd->strdup(tmp_sctx->user ? tmp_sctx->user :
(tmp->system_thread ? (tmp->system_thread ?
"system user" : "unauthenticated user")); "system user" : "unauthenticated user"));
...@@ -2923,6 +2925,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) ...@@ -2923,6 +2925,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[15]->set_notnull(); table->field[15]->set_notnull();
} }
table->field[16]->store(tmp->os_thread_id);
if (schema_table_store_record(thd, table)) if (schema_table_store_record(thd, table))
{ {
mysql_mutex_unlock(&LOCK_thread_count); mysql_mutex_unlock(&LOCK_thread_count);
...@@ -8738,6 +8742,7 @@ ST_FIELD_INFO processlist_fields_info[]= ...@@ -8738,6 +8742,7 @@ ST_FIELD_INFO processlist_fields_info[]=
{"QUERY_ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, SKIP_OPEN_TABLE}, {"QUERY_ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, SKIP_OPEN_TABLE},
{"INFO_BINARY", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_BLOB, 0, 1, {"INFO_BINARY", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_BLOB, 0, 1,
"Info_binary", SKIP_OPEN_TABLE}, "Info_binary", SKIP_OPEN_TABLE},
{"TID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Tid", SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment