List:Commits« Previous MessageNext Message »
From:Marc Alff Date:July 21 2010 7:07pm
Subject:bzr commit into mysql-next-mr branch (marc.alff:3163)
View as plain text  
#At file:///home/malff/BZR_TREE/mysql-next-mr-wl4674/ based on revid:marc.alff@stripped

 3163 Marc Alff	2010-07-21
      Code cleanup.
      
      Manual merge for the missing implementation of column THREADS.PARENT_THREAD_ID from mysql-next-mr-perfschema

    modified:
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/table_threads.cc
      storage/perfschema/table_threads.h
=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2010-07-10 03:31:35 +0000
+++ b/storage/perfschema/pfs.cc	2010-07-21 19:06:21 +0000
@@ -997,9 +997,25 @@ void* pfs_spawn_thread(void *arg)
   /* First, attach instrumentation to this newly created pthread. */
   PFS_thread_class *klass= find_thread_class(typed_arg->m_child_key);
   if (likely(klass != NULL))
+  {
     pfs= create_thread(klass, typed_arg->m_child_identity, 0);
+    if (likely(pfs != NULL))
+    {
+      PFS_thread *parent= typed_arg->m_parent_thread;
+
+      pfs->m_parent_thread_internal_id= parent->m_thread_internal_id;
+
+      memcpy_fixed(pfs->m_username, parent->m_username, sizeof(pfs->m_username));
+      pfs->m_username_length= parent->m_username_length;
+
+      memcpy_fixed(pfs->m_hostname, parent->m_hostname, sizeof(pfs->m_hostname));
+      pfs->m_hostname_length= parent->m_hostname_length;
+    }
+  }
   else
+  {
     pfs= NULL;
+  }
   my_pthread_setspecific_ptr(THR_PFS, pfs);
 
   /*

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2010-07-10 03:31:35 +0000
+++ b/storage/perfschema/pfs_instr.cc	2010-07-21 19:06:21 +0000
@@ -728,6 +728,7 @@ PFS_thread* create_thread(PFS_thread_cla
         {
           pfs->m_thread_internal_id=
             PFS_atomic::add_u32(&thread_internal_id_counter, 1);
+          pfs->m_parent_thread_internal_id= 0;
           pfs->m_thread_id= thread_id;
           pfs->m_event_id= 1;
           pfs->m_enabled= true;

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2010-07-10 03:31:35 +0000
+++ b/storage/perfschema/pfs_instr.h	2010-07-21 19:06:21 +0000
@@ -196,6 +196,8 @@ struct PFS_thread
   bool m_enabled;
   /** Internal thread identifier, unique. */
   ulong m_thread_internal_id;
+  /** Parent internal thread identifier. */
+  ulong m_parent_thread_internal_id;
   /** External (SHOW PROCESSLIST) thread identifier, not unique. */
   ulong m_thread_id;
   /** Thread class. */

=== modified file 'storage/perfschema/table_threads.cc'
--- a/storage/perfschema/table_threads.cc	2010-07-02 16:15:37 +0000
+++ b/storage/perfschema/table_threads.cc	2010-07-21 19:06:21 +0000
@@ -183,6 +183,7 @@ void table_threads::make_row(PFS_thread
     return;
 
   m_row.m_thread_internal_id= pfs->m_thread_internal_id;
+  m_row.m_parent_thread_internal_id= pfs->m_parent_thread_internal_id;
   m_row.m_thread_id= pfs->m_thread_id;
   m_row.m_name= safe_class->m_name;
   m_row.m_name_length= safe_class->m_name_length;
@@ -294,7 +295,10 @@ int table_threads::read_row_values(TABLE
           f->set_null();
         break;
       case 11: /* PARENT_THREAD_ID */
-        f->set_null();
+        if (m_row.m_parent_thread_internal_id != 0)
+          set_field_ulong(f, m_row.m_parent_thread_internal_id);
+        else
+          f->set_null();
         break;
       case 12: /* ROLE */
         f->set_null();

=== modified file 'storage/perfschema/table_threads.h'
--- a/storage/perfschema/table_threads.h	2010-07-10 03:31:35 +0000
+++ b/storage/perfschema/table_threads.h	2010-07-21 19:06:21 +0000
@@ -65,6 +65,8 @@ struct row_threads
   uint m_processlist_info_length;
   /** Column INSTRUMENTED. */
   bool *m_enabled_ptr;
+  /** Column PARENT_THREAD_ID. */
+  ulong m_parent_thread_internal_id;
 };
 
 /** Table PERFORMANCE_SCHEMA.THREADS. */


Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100721190621-dciay6d8lq9qaxzx.bundle
Thread
bzr commit into mysql-next-mr branch (marc.alff:3163) Marc Alff21 Jul