List:Commits« Previous Message
From:Mayank Prasad Date:July 12 2013 12:32pm
Subject:bzr push into mysql-trunk branch (mayank.prasad:5724 to 5725) WL#5766
View as plain text  
 5725 mayank prasad	2013-07-12
      WL#5766 : PERFORMANCE SCHEMA, stored programs instrumentation.
      
      Details:
       - Modified code to put MYSQL_GET_SP_SHARE at correct place to
         make sure SP gets into PS table only when they are created 
         successfully.

    modified:
      sql/event_data_objects.cc
      sql/sp.cc
      sql/sp_head.cc
      sql/sql_yacc.yy
      sql/trigger.cc
=== modified file 'sql/event_data_objects.cc'
--- a/sql/event_data_objects.cc	revid:mayank.prasad@stripped
+++ b/sql/event_data_objects.cc	revid:mayank.prasad@stripped
@@ -32,6 +32,8 @@
 #include "sp_head.h"
 #include "sql_show.h"                // append_definer, append_identifier
 
+#include "mysql/psi/mysql_sp.h"
+
 /**
   @addtogroup Event_Scheduler
   @{
@@ -1436,6 +1438,13 @@ Event_job_data::execute(THD *thd, bool d
     sphead->set_creation_ctx(creation_ctx);
     sphead->optimize();
 
+    sphead->m_type= SP_TYPE_EVENT;
+#ifdef HAVE_PSI_SP_INTERFACE
+    sphead->m_sp_share= MYSQL_GET_SP_SHARE(SP_OBJECT_TYPE_EVENT,
+                                           dbname.str, dbname.length,
+                                           name.str, name.length);
+#endif
+
     ret= sphead->execute_procedure(thd, &empty_item_list);
     /*
       There is no pre-locking and therefore there should be no

=== modified file 'sql/sp.cc'
--- a/sql/sp.cc	revid:mayank.prasad@stripped
+++ b/sql/sp.cc	revid:mayank.prasad@stripped
@@ -784,6 +784,12 @@ static sp_head *sp_compile(THD *thd, Str
   thd->sp_runtime_ctx= sp_runtime_ctx_saved;
   thd->variables.sql_mode= old_sql_mode;
   thd->variables.select_limit= old_select_limit;
+#ifdef HAVE_PSI_SP_INTERFACE
+  sp->m_sp_share= MYSQL_GET_SP_SHARE(sp->m_type == SP_TYPE_PROCEDURE ?
+                                     SP_OBJECT_TYPE_PROCEDURE : SP_OBJECT_TYPE_FUNCTION,
+                                     sp->m_db.str, sp->m_db.length,
+                                     sp->m_name.str, sp->m_name.length);
+#endif
   return sp;
 }
 

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	revid:mayank.prasad@stripped
+++ b/sql/sp_head.cc	revid:mayank.prasad@stripped
@@ -321,32 +321,6 @@ void sp_head::init_sp_name(THD *thd, sp_
   m_qname.str= (char*) memdup_root(thd->mem_root,
                                    spname->m_qname.str,
                                    spname->m_qname.length + 1);
-#ifdef HAVE_PSI_SP_INTERFACE
-  enum_sp_object_type sp_object_type;
-  switch(m_type)
-  {
-    case SP_TYPE_EVENT:
-        sp_object_type= SP_OBJECT_TYPE_EVENT;
-      break;
-    case SP_TYPE_FUNCTION:
-        sp_object_type= SP_OBJECT_TYPE_FUNCTION;
-      break;
-    case SP_TYPE_PROCEDURE:
-        sp_object_type= SP_OBJECT_TYPE_PROCEDURE;
-      break;
-    case SP_TYPE_TRIGGER:
-        sp_object_type= SP_OBJECT_TYPE_TRIGGER;
-      break;
-    default:
-        DBUG_ASSERT(0);
-      break;
-  }
-
-  m_sp_share= MYSQL_GET_SP_SHARE(sp_object_type,
-                                 m_db.str, m_db.length,
-                                 m_name.str, m_name.length);
-#endif
-
 }
 
 

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	revid:mayank.prasad@stripped
+++ b/sql/sql_yacc.yy	revid:mayank.prasad@stripped
@@ -2605,7 +2605,7 @@ ev_sql_stmt:
             }
 
             sp_head *sp= sp_start_parsing(thd,
-                                          SP_TYPE_PROCEDURE,
+                                          SP_TYPE_EVENT,
                                           lex->event_parse_data->identifier);
 
             if (!sp)

=== modified file 'sql/trigger.cc'
--- a/sql/trigger.cc	revid:mayank.prasad@stripped
+++ b/sql/trigger.cc	revid:mayank.prasad@stripped
@@ -25,6 +25,7 @@
 #include "sql_show.h"             // append_identifier
 #include "sql_db.h"               // get_default_db_collation
 
+#include "mysql/psi/mysql_sp.h"
 ///////////////////////////////////////////////////////////////////////////
 
 /**
@@ -668,6 +669,12 @@ bool Trigger::parse(THD *thd)
 
   m_sp->set_definer(m_definer.str, m_definer.length);
 
+#ifdef HAVE_PSI_SP_INTERFACE
+  m_sp->m_sp_share= MYSQL_GET_SP_SHARE(SP_OBJECT_TYPE_TRIGGER,
+                                       m_sp->m_db.str, m_sp->m_db.length,
+                                       m_sp->m_name.str, m_sp->m_name.length);
+#endif
+
 #ifndef DBUG_OFF
   /*
     Check that we correctly update trigger definitions when we rename tables

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (mayank.prasad:5724 to 5725) WL#5766Mayank Prasad20 Aug