summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2015-08-12 23:09:48 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2015-09-17 14:30:58 +0200
commit7dd137c4ac0352595cb3aa5c718afba46bf2baf2 (patch)
treed4a21cc9bb38313c0827b66e71534a04890714fe /sql/sql_show.cc
parentd9b25ae3db8584bde809c0ab3230cbe151fa489b (diff)
downloadmariadb-git-7dd137c4ac0352595cb3aa5c718afba46bf2baf2.tar.gz
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
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index bb06efb27ba..42da649e3d7 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2334,6 +2334,7 @@ public:
{ TRASH(ptr, size); }
ulong thread_id;
+ ulong os_thread_id;
ulonglong start_time;
uint command;
const char *user,*host,*db,*proc_info,*state_info;
@@ -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;
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 :
(tmp->system_thread ?
"system user" : "unauthenticated user"));
@@ -2923,6 +2925,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[15]->set_notnull();
}
+ table->field[16]->store(tmp->os_thread_id);
+
if (schema_table_store_record(thd, table))
{
mysql_mutex_unlock(&LOCK_thread_count);
@@ -8738,6 +8742,7 @@ ST_FIELD_INFO processlist_fields_info[]=
{"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", 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}
};