List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:July 9 2010 2:23am
Subject:bzr push into mysql-next-mr-wl4896 branch (chris.powers:3152 to 3153) WL#4896
View as plain text  
 3153 Christopher Powers	2010-07-08
      WL#4896 PERFORMANCE_SCHEMA Instrumenting Net IO
      
      Various bug fixes for last push

    modified:
      scripts/mysql_system_tables.sql
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_engine_table.h
      storage/perfschema/pfs_events_waits.h
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/table_all_instr.cc
      storage/perfschema/table_all_instr.h
      storage/perfschema/table_events_waits_summary.h
      storage/perfschema/table_setup_instruments.h
      storage/perfschema/table_socket_instances.cc
      storage/perfschema/table_socket_instances.h
 3152 Christopher Powers	2010-07-07
      WL#4896 PERFORMANCE_SCHEMA Instrumenting Net IO
      
      Added SOCKET_INSTANCES table, completed instrumentation of socket API

    added:
      storage/perfschema/table_socket_instances.cc
      storage/perfschema/table_socket_instances.h
    modified:
      include/mysql/psi/mysql_socket.h
      scripts/mysql_system_tables.sql
      sql/mysqld.cc
      sql/mysqld.h
      sql/sys_vars.cc
      storage/perfschema/CMakeLists.txt
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_engine_table.h
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_instr_class.cc
      storage/perfschema/pfs_server.cc
      storage/perfschema/pfs_server.h
      storage/perfschema/table_all_instr.cc
      storage/perfschema/table_all_instr.h
      storage/perfschema/table_events_waits_summary.cc
      storage/perfschema/table_events_waits_summary.h
      storage/perfschema/table_setup_instruments.cc
      storage/perfschema/table_setup_instruments.h
=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2010-07-07 19:49:15 +0000
+++ b/scripts/mysql_system_tables.sql	2010-07-09 02:23:31 +0000
@@ -364,13 +364,12 @@ DROP PREPARE stmt;
 --
 
 SET @l1="CREATE TABLE performance_schema.SOCKET_INSTANCES(";
-SET @l2="SOCKET_DESC VARCHAR(512) not null,";
-SET @l3="EVENT_NAME VARCHAR(128) not null,";
-SET @l4="IDENTITY BIGINT not null,";
-SET @l5="OPEN_COUNT INTEGER unsigned not null";
-SET @l6=")ENGINE=PERFORMANCE_SCHEMA;";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="SOCKET_DESC VARCHAR(512) not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
 
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
 
 SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
 PREPARE stmt FROM @str;

=== modified file 'storage/perfschema/ha_perfschema.cc'
--- a/storage/perfschema/ha_perfschema.cc	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/ha_perfschema.cc	2010-07-09 02:23:31 +0000
@@ -126,7 +126,7 @@ static struct st_mysql_show_var pfs_stat
   {"Performance_schema_file_handles_lost",
     (char*) &file_handle_lost, SHOW_LONG},
   {"Performance_schema_socket_instances_lost",
-    (char*) &socket_lost, SHOW_LONG},
+    (char*) &socket_instances_lost, SHOW_LONG},
   {"Performance_schema_locker_lost",
     (char*) &locker_lost, SHOW_LONG},
   /* table shares, can be flushed */

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/pfs.cc	2010-07-09 02:23:31 +0000
@@ -1565,12 +1565,12 @@ get_thread_socket_locker_v1(PSI_socket *
   else
     pfs_locker->m_waits_current.m_timer_state= TIMER_STATE_UNTIMED;
 
-  pfs_locker->m_waits_current.m_object_instance_addr= pfs_socket; // TBD
+  pfs_locker->m_waits_current.m_object_instance_addr= pfs_socket;
   pfs_locker->m_waits_current.m_object_name= pfs_socket->m_socket_desc;
   pfs_locker->m_waits_current.m_object_name_length= pfs_socket->m_socket_desc_length;
   pfs_locker->m_waits_current.m_event_id= pfs_thread->m_event_id++;
   pfs_locker->m_waits_current.m_operation= socket_operation_map[static_cast<int>(op)];
-  pfs_locker->m_waits_current.m_wait_class= WAIT_CLASS_FILE;
+  pfs_locker->m_waits_current.m_wait_class= WAIT_CLASS_SOCKET;
 
   pfs_thread->m_wait_locker_count++;
   return reinterpret_cast<PSI_socket_locker*> (pfs_locker);

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2010-07-09 02:23:31 +0000
@@ -750,11 +750,11 @@ bool pfs_show_status(handlerton *hton, T
       break;
     case 51:
       name= "SOCKET_INSTANCES.ROW_COUNT";
-      size= socket_max;
+      size= socket_instances_max;
       break;
     case 52:
       name= "SOCKET_INSTANCES.MEMORY";
-      size= socket_max * sizeof(PFS_socket);
+      size= socket_instances_max * sizeof(PFS_socket);
       total_memory+= size;
       break;
     /*

=== modified file 'storage/perfschema/pfs_engine_table.h'
--- a/storage/perfschema/pfs_engine_table.h	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/pfs_engine_table.h	2010-07-09 02:23:31 +0000
@@ -295,11 +295,13 @@ struct PFS_triple_index
 
 struct PFS_instrument_view_constants
 {
+  static const uint FIRST_VIEW=1;
   static const uint VIEW_MUTEX= 1;
   static const uint VIEW_RWLOCK= 2;
   static const uint VIEW_COND= 3;
   static const uint VIEW_FILE= 4;
   static const uint VIEW_SOCKET= 5;
+  static const uint LAST_VIEW= 6;
 };
 
 struct PFS_object_view_constants

=== modified file 'storage/perfschema/pfs_events_waits.h'
--- a/storage/perfschema/pfs_events_waits.h	2010-06-22 23:15:38 +0000
+++ b/storage/perfschema/pfs_events_waits.h	2010-07-09 02:23:31 +0000
@@ -41,7 +41,8 @@ enum events_waits_class
   WAIT_CLASS_RWLOCK,
   WAIT_CLASS_COND,
   WAIT_CLASS_TABLE,
-  WAIT_CLASS_FILE
+  WAIT_CLASS_FILE,
+  WAIT_CLASS_SOCKET
 };
 
 /** State of a timer. */

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/pfs_instr.cc	2010-07-09 02:23:31 +0000
@@ -64,9 +64,9 @@ ulong table_max;
 /** Number of table instances lost. @sa table_array */
 ulong table_lost;
 /** Size of the socket instances array. @sa socket_array */
-ulong socket_max;
+ulong socket_instances_max;
 /** Number of socket instances lost. @sa socket_array */
-ulong socket_lost;
+ulong socket_instances_lost;
 /** Number of EVENTS_WAITS_HISTORY records per thread. */
 ulong events_waits_history_per_thread;
 /** Number of instruments class per thread. */
@@ -126,8 +126,8 @@ PFS_table *table_array= NULL;
 
 /**
   Socket instrumentation instances array.
-  @sa socket_max
-  @sa socket_lost
+  @sa socket_instances_max
+  @sa socket_instances_lost
 */
 PFS_socket *socket_array= NULL;
 
@@ -175,8 +175,8 @@ int init_instruments(const PFS_global_pa
   table_lost= 0;
   thread_max= param->m_thread_sizing;
   thread_lost= 0;
-  socket_max= param->m_socket_sizing;
-  socket_lost= 0;
+  socket_instances_max= param->m_socket_sizing;
+  socket_instances_lost= 0;
 
   events_waits_history_per_thread= param->m_events_waits_history_sizing;
   thread_history_sizing= param->m_thread_sizing
@@ -243,9 +243,9 @@ int init_instruments(const PFS_global_pa
       return 1;
   }
 
-  if (socket_max > 0)
+  if (socket_instances_max > 0)
   {
-    socket_array= PFS_MALLOC_ARRAY(socket_max, PFS_socket, MYF(MY_ZEROFILL));
+    socket_array= PFS_MALLOC_ARRAY(socket_instances_max, PFS_socket, MYF(MY_ZEROFILL));
     if (unlikely(socket_array == NULL))
       return 1;
   }
@@ -448,7 +448,7 @@ void cleanup_instruments(void)
   file_handle_max= 0;
   pfs_free(socket_array);
   socket_array= NULL;
-  socket_max= 0;
+  socket_instances_max= 0;
   pfs_free(table_array);
   table_array= NULL;
   table_max= 0;
@@ -1105,9 +1105,9 @@ void destroy_table(PFS_table *pfs)
 PFS_socket* create_socket(PFS_socket_class *klass, const void *identity)
 {
   PFS_scan scan;
-  uint random= randomized_index(identity, socket_max);
+  uint random= randomized_index(identity, socket_instances_max);
 
-  for (scan.init(random, socket_max);
+  for (scan.init(random, socket_instances_max);
        scan.has_pass();
        scan.next_pass())
   {
@@ -1131,7 +1131,7 @@ PFS_socket* create_socket(PFS_socket_cla
     }
   }
 
-  socket_lost++;
+  socket_instances_lost++;
   return NULL;
 }
 

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/pfs_instr.h	2010-07-09 02:23:31 +0000
@@ -309,8 +309,8 @@ extern long file_handle_max;
 extern ulong file_handle_lost;
 extern ulong table_max;
 extern ulong table_lost;
-extern ulong socket_max;
-extern ulong socket_lost;
+extern ulong socket_instances_max;
+extern ulong socket_instances_lost;
 extern ulong events_waits_history_per_thread;
 extern ulong instr_class_per_thread;
 extern ulong locker_lost;

=== modified file 'storage/perfschema/table_all_instr.cc'
--- a/storage/perfschema/table_all_instr.cc	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/table_all_instr.cc	2010-07-09 02:23:31 +0000
@@ -96,7 +96,7 @@ int table_all_instr::rnd_next(void)
       }
       break;
     case pos_all_instr::VIEW_SOCKET:
-      for ( ; m_pos.m_index_2 < socket_max; m_pos.m_index_2++)
+      for ( ; m_pos.m_index_2 < socket_instances_max; m_pos.m_index_2++)
       {
         socket= &socket_array[m_pos.m_index_2];
         if (socket->m_lock.is_populated())
@@ -161,7 +161,7 @@ int table_all_instr::rnd_pos(const void
     }
     break;
   case pos_all_instr::VIEW_SOCKET:
-    DBUG_ASSERT(m_pos.m_index_2 < socket_max);
+    DBUG_ASSERT(m_pos.m_index_2 < socket_instances_max);
     socket= &socket_array[m_pos.m_index_2];
     if (socket->m_lock.is_populated())
     {

=== modified file 'storage/perfschema/table_all_instr.h'
--- a/storage/perfschema/table_all_instr.h	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/table_all_instr.h	2010-07-09 02:23:31 +0000
@@ -35,17 +35,17 @@ struct pos_all_instr_class : public PFS_
                              public PFS_instrument_view_constants
 {
   pos_all_instr_class()
-    : PFS_double_index(VIEW_MUTEX, 1)
+    : PFS_double_index(FIRST_VIEW, 1)
   {}
 
   inline void reset(void)
   {
-    m_index_1= VIEW_MUTEX;
+    m_index_1= FIRST_VIEW;
     m_index_2= 1;
   }
 
   inline bool has_more_view(void)
-  { return (m_index_1 <= VIEW_SOCKET); }
+  { return (m_index_1 <= LAST_VIEW); }
 
   inline void next_view(void)
   {
@@ -95,17 +95,17 @@ struct pos_all_instr : public PFS_double
                        public PFS_instrument_view_constants
 {
   pos_all_instr()
-    : PFS_double_index(VIEW_MUTEX, 0)
+    : PFS_double_index(FIRST_VIEW, 0)
   {}
 
   inline void reset(void)
   {
-    m_index_1= VIEW_MUTEX;
+    m_index_1= FIRST_VIEW;
     m_index_2= 0;
   }
 
   inline bool has_more_view(void)
-  { return (m_index_1 <= VIEW_SOCKET); }
+  { return (m_index_1 <= LAST_VIEW); }
 
   inline void next_view(void)
   {

=== modified file 'storage/perfschema/table_events_waits_summary.h'
--- a/storage/perfschema/table_events_waits_summary.h	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/table_events_waits_summary.h	2010-07-09 02:23:31 +0000
@@ -64,13 +64,13 @@ struct pos_events_waits_summary_by_threa
 : public PFS_triple_index, public PFS_instrument_view_constants
 {
   pos_events_waits_summary_by_thread_by_event_name()
-    : PFS_triple_index(0, VIEW_MUTEX, 1)
+    : PFS_triple_index(0, FIRST_VIEW, 1)
   {}
 
   inline void reset(void)
   {
     m_index_1= 0;
-    m_index_2= VIEW_MUTEX;
+    m_index_2= FIRST_VIEW;
     m_index_3= 1;
   }
 
@@ -78,12 +78,12 @@ struct pos_events_waits_summary_by_threa
   { return (m_index_1 < thread_max); }
 
   inline bool has_more_view(void)
-  { return (m_index_2 <= VIEW_SOCKET); }
+  { return (m_index_2 <= LAST_VIEW); }
 
   inline void next_thread(void)
   {
     m_index_1++;
-    m_index_2= VIEW_MUTEX;
+    m_index_2= FIRST_VIEW;
     m_index_3= 1;
   }
 

=== modified file 'storage/perfschema/table_setup_instruments.h'
--- a/storage/perfschema/table_setup_instruments.h	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/table_setup_instruments.h	2010-07-09 02:23:31 +0000
@@ -45,6 +45,7 @@ struct row_setup_instruments
 /** Position of a cursor on PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS. */
 struct pos_setup_instruments : public PFS_double_index
 {
+  static const uint FIRST_VIEW= 1;
   static const uint VIEW_MUTEX= 1;
   static const uint VIEW_RWLOCK= 2;
   static const uint VIEW_COND= 3;
@@ -52,19 +53,20 @@ struct pos_setup_instruments : public PF
   static const uint VIEW_THREAD= 4;
   static const uint VIEW_FILE= 5;
   static const uint VIEW_SOCKET= 6;
+  static const uint LAST_VIEW= 6;
 
   pos_setup_instruments()
-    : PFS_double_index(VIEW_MUTEX, 1)
+    : PFS_double_index(FIRST_VIEW, 1)
   {}
 
   inline void reset(void)
   {
-    m_index_1= VIEW_MUTEX;
+    m_index_1= FIRST_VIEW;
     m_index_2= 1;
   }
 
   inline bool has_more_view(void)
-  { return (m_index_1 <= VIEW_FILE); }
+  { return (m_index_1 <= LAST_VIEW); }
 
   inline void next_view(void)
   {

=== modified file 'storage/perfschema/table_socket_instances.cc'
--- a/storage/perfschema/table_socket_instances.cc	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/table_socket_instances.cc	2010-07-09 02:23:31 +0000
@@ -31,30 +31,25 @@ THR_LOCK table_socket_instances::m_table
 static const TABLE_FIELD_TYPE field_types[]=
 {
   {
-    { C_STRING_WITH_LEN("SOCKET_DESC") },
-    { C_STRING_WITH_LEN("varchar(512)") },
-    { NULL, 0}
-  },
-  {
     { C_STRING_WITH_LEN("EVENT_NAME") },
     { C_STRING_WITH_LEN("varchar(128)") },
     { NULL, 0}
   },
   {
-    { C_STRING_WITH_LEN("IDENTITY") }, // TBD
+    { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") },
     { C_STRING_WITH_LEN("bigint(20)") },
     { NULL, 0}
   },
   {
-    { C_STRING_WITH_LEN("OPEN_COUNT") },
-    { C_STRING_WITH_LEN("int(10)") },
+    { C_STRING_WITH_LEN("SOCKET_DESC") },
+    { C_STRING_WITH_LEN("varchar(512)") },
     { NULL, 0}
   }
 };
 
 TABLE_FIELD_DEF
 table_socket_instances::m_field_def=
-{ 4, field_types };
+{ 3, field_types };
 
 PFS_engine_table_share
 table_socket_instances::m_share=
@@ -92,7 +87,7 @@ int table_socket_instances::rnd_next(voi
   PFS_socket *pfs;
 
   for (m_pos.set_at(&m_next_pos);
-       m_pos.m_index < socket_max;
+       m_pos.m_index < socket_instances_max;
        m_pos.next())
   {
     pfs= &socket_array[m_pos.m_index];
@@ -112,7 +107,7 @@ int table_socket_instances::rnd_pos(cons
   PFS_socket *pfs;
 
   set_position(pos);
-  DBUG_ASSERT(m_pos.m_index < socket_max);
+  DBUG_ASSERT(m_pos.m_index < socket_instances_max);
   pfs= &socket_array[m_pos.m_index];
 
   if (! pfs->m_lock.is_populated())
@@ -136,12 +131,11 @@ void table_socket_instances::make_row(PF
   if (unlikely(safe_class == NULL))
     return;
 
-  m_row.m_socket_desc=        pfs->m_socket_desc;
-  m_row.m_socket_desc_length= pfs->m_socket_desc_length;
   m_row.m_event_name=         safe_class->m_name;
   m_row.m_event_name_length=  safe_class->m_name_length;
   m_row.m_identity=           pfs->m_identity;
-  m_row.m_open_count=         pfs->m_socket_stat.m_open_count;
+  m_row.m_socket_desc=        pfs->m_socket_desc;
+  m_row.m_socket_desc_length= pfs->m_socket_desc_length;
 
   if (pfs->m_lock.end_optimistic_lock(&lock))
     m_row_exists= true;
@@ -154,7 +148,7 @@ int table_socket_instances::read_row_val
 {
   Field *f;
 
-  if (unlikely(! m_row_exists))
+  if (unlikely(!m_row_exists))
     return HA_ERR_RECORD_DELETED;
 
   /* Set the null bits */
@@ -166,17 +160,14 @@ int table_socket_instances::read_row_val
     {
       switch(f->field_index)
       {
-      case 0: /* SOCKET_DESC */
-        set_field_varchar_utf8(f, m_row.m_socket_desc, m_row.m_socket_desc_length);
-        break;
-      case 1: /* EVENT_NAME */
+      case 0: /* EVENT_NAME */
         set_field_varchar_utf8(f, m_row.m_event_name, m_row.m_event_name_length);
         break;
-      case 2: /* IDENTITY */
+      case 1: /* OBJECT_INSTANCE_BEGIN */
         set_field_ulonglong(f, (intptr)m_row.m_identity);
         break;
-      case 3: /* OPEN_COUNT */
-        set_field_ulong(f, m_row.m_open_count);
+      case 2: /* SOCKET_DESC */
+        set_field_varchar_utf8(f, m_row.m_socket_desc, m_row.m_socket_desc_length);
         break;
       default:
         DBUG_ASSERT(false);

=== modified file 'storage/perfschema/table_socket_instances.h'
--- a/storage/perfschema/table_socket_instances.h	2010-07-07 19:49:15 +0000
+++ b/storage/perfschema/table_socket_instances.h	2010-07-09 02:23:31 +0000
@@ -32,18 +32,16 @@
 /** A row of PERFORMANCE_SCHEMA.SOCKET_INSTANCES. */
 struct row_socket_instances
 {
-  /** Column SOCKET_DESC. */
-  const char *m_socket_desc;
-  /** Length in bytes of @c m_socket_desc. */
-  uint m_socket_desc_length;
   /** Column EVENT_NAME. */
   const char *m_event_name;
   /** Length in bytes of @c m_event_name. */
   uint m_event_name_length;
-  /** IDENTITY TBD */
+  /** Column OBJECT_INSTANCE_BEGIN */
   const void *m_identity;
-  /** Column OPEN_COUNT. */
-  uint m_open_count;
+  /** Column SOCKET_DESC. */
+  const char *m_socket_desc;
+  /** Length in bytes of @c m_socket_desc. */
+  uint m_socket_desc_length;
 };
 
 /** Table PERFORMANCE_SCHEMA.SOCKET_INSTANCES. */


Attachment: [text/bzr-bundle] bzr/chris.powers@oracle.com-20100709022331-kubjkine76wfm3mi.bundle
Thread
bzr push into mysql-next-mr-wl4896 branch (chris.powers:3152 to 3153) WL#4896Christopher Powers9 Jul