On 7/9/11 11:27 AM, ghazel@stripped wrote:
> On Sat, Jul 9, 2011 at 7:26 AM, Davi Arnaut <davi.arnaut@stripped> wrote:
>> Hi Greg,
>> On 7/9/11 11:14 AM, ghazel@stripped wrote:
>>> On Sat, Jul 9, 2011 at 7:00 AM, Davi Arnaut <davi.arnaut@stripped>
>>>> On 7/6/11 1:50 PM, ghazel@stripped wrote:
>>>>> First off, where can I find a real commit message? Second, is there
>>>>> way to get the OS thread id now? It was very handy when tying MySQL
>>>>> thread id to OS thread id for debugging with gdb.
>>>> How did you tie the MySQL thread id to the OS thread id? InnoDB did not
>>>> actually provide the OS thread id, it provide the value of the thread
>>>> descriptor. It was handy for locating the THD object? What exactly did
>>>> it help with?
>>> The "show engine innodb status" transaction output list(ed) both the
>>> "MySQL thread id" and the "OS thread id":
>>> ---TRANSACTION CF5F643A, ACTIVE 14 sec, process no 410, OS thread id
>>> 2 lock struct(s), heap size 376, 1 row lock(s)
>>> MySQL thread id 928182, query id 43574254 localhost root User sleep
>>> select sleep(200)
>>> When represented in hex, 1493494080 is 0x5904e940 which matches the
>>> identifier printed by gdb:
>>> Thread 11 (Thread 0x5904e940 (LWP 1113)):
>> 0x5904e940 is the thread handle (ie pthread_self()), while 1113 is the
>> actual thread id. So, basically, you just want to be able to identify
>> which particular actual thread was last associated with a query/trans?
> That's right.
Does the attached patch fix it for you?
=== modified file 'sql/sql_class.cc'
--- sql/sql_class.cc 2011-07-07 09:42:14 +0000
+++ sql/sql_class.cc 2011-07-09 14:43:05 +0000
@@ -655,8 +655,8 @@ char *thd_security_context(THD *thd, cha
const char *proc_info= thd->proc_info;
len= my_snprintf(header, sizeof(header),
- "MySQL thread id %lu, query id %lu",
- thd->thread_id, (ulong) thd->query_id);
+ "MySQL thread id %lu, OS thread handle 0x%lx, query id %lu",
+ thd->thread_id, (ulong) thd->real_id, (ulong) thd->query_id);