List:Commits« Previous MessageNext Message »
From:Marc Alff Date:September 30 2009 8:43am
Subject:bzr commit into mysql-trunk-perfschema branch (marc.alff:2898) WL#2360
View as plain text  
#At file:///home/malff/BZR_TREE/mysql-trunk-perfschema/ based on revid:marc.alff@strippeduh42xt

 2898 Marc Alff	2009-09-30
      WL#2360 Performance schema
      
      Manual port, continued

    modified:
      client/mysqlcheck.c
      client/mysqldump.c
      mysql-test/r/1st.result
      mysql-test/r/drop.result
      mysql-test/r/information_schema.result
      mysql-test/r/ps_1general.result
      mysql-test/r/schema.result
      mysql-test/r/show_check.result
      mysql-test/suite/binlog/r/binlog_database.result
      mysql-test/suite/jp/r/jp_create_db_sjis.result
      mysql-test/suite/jp/r/jp_create_db_ucs2.result
      mysql-test/suite/jp/r/jp_create_db_ujis.result
      mysql-test/suite/jp/r/jp_create_db_utf8.result
      sql/sql_plugin.cc
=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c	2009-07-14 17:08:38 +0000
+++ b/client/mysqlcheck.c	2009-09-30 08:43:17 +0000
@@ -644,6 +644,9 @@ static int use_db(char *database)
   if (mysql_get_server_version(sock) >= 50003 &&
       !my_strcasecmp(&my_charset_latin1, database, "information_schema"))
     return 1;
+  if (mysql_get_server_version(sock) >= 50400 &&
+      !my_strcasecmp(&my_charset_latin1, database, "performance_schema"))
+    return 1;
   if (mysql_select_db(sock, database))
   {
     DBerror(sock, "when selecting the database");

=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2009-08-28 15:06:59 +0000
+++ b/client/mysqldump.c	2009-09-30 08:43:17 +0000
@@ -3831,6 +3831,10 @@ static int dump_all_databases()
         !my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
       continue;
 
+    if (mysql_get_server_version(mysql) >= 50400 &&
+        !my_strcasecmp(&my_charset_latin1, row[0], "performance_schema"))
+      continue;
+
     if (dump_all_tables_in_db(row[0]))
       result=1;
   }
@@ -3849,6 +3853,10 @@ static int dump_all_databases()
           !my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
         continue;
 
+      if (mysql_get_server_version(mysql) >= 50400 &&
+          !my_strcasecmp(&my_charset_latin1, row[0], "performance_schema"))
+        continue;
+
       if (dump_all_views_in_db(row[0]))
         result=1;
     }
@@ -4247,10 +4255,12 @@ static int dump_selected_tables(char *db
   }
   end= pos;
 
-  /* Can't LOCK TABLES in INFORMATION_SCHEMA, so don't try. */
+  /* Can't LOCK TABLES in I_S / P_S, so don't try. */
   if (lock_tables &&
       !(mysql_get_server_version(mysql) >= 50003 &&
-        !my_strcasecmp(&my_charset_latin1, db, "information_schema")))
+        !my_strcasecmp(&my_charset_latin1, db, "information_schema")) &&
+      !(mysql_get_server_version(mysql) >= 50400 &&
+        !my_strcasecmp(&my_charset_latin1, db, "perfschema_schema")))
   {
     if (mysql_real_query(mysql, lock_tables_query.str,
                          lock_tables_query.length-1))

=== modified file 'mysql-test/r/1st.result'
--- a/mysql-test/r/1st.result	2008-04-02 08:06:36 +0000
+++ b/mysql-test/r/1st.result	2009-09-30 08:43:17 +0000
@@ -3,6 +3,7 @@ Database
 information_schema
 mtr
 mysql
+performance_schema
 test
 show tables in mysql;
 Tables_in_mysql

=== modified file 'mysql-test/r/drop.result'
--- a/mysql-test/r/drop.result	2008-04-03 09:50:43 +0000
+++ b/mysql-test/r/drop.result	2009-09-30 08:43:17 +0000
@@ -50,6 +50,7 @@ information_schema
 mtr
 mysql
 mysqltest
+performance_schema
 test
 flush tables with read lock;
 drop database mysqltest;
@@ -61,6 +62,7 @@ Database
 information_schema
 mtr
 mysql
+performance_schema
 test
 drop database mysqltest;
 ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist

=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2009-08-07 20:04:53 +0000
+++ b/mysql-test/r/information_schema.result	2009-09-30 08:43:17 +0000
@@ -11,12 +11,14 @@ select * from information_schema.SCHEMAT
 CATALOG_NAME	SCHEMA_NAME	DEFAULT_CHARACTER_SET_NAME	DEFAULT_COLLATION_NAME	SQL_PATH
 NULL	mtr	latin1	latin1_swedish_ci	NULL
 NULL	mysql	latin1	latin1_swedish_ci	NULL
+NULL	performance_schema	utf8	utf8_general_ci	NULL
 NULL	test	latin1	latin1_swedish_ci	NULL
 select schema_name from information_schema.schemata;
 schema_name
 information_schema
 mtr
 mysql
+performance_schema
 test
 show databases like 't%';
 Database (t%)
@@ -26,6 +28,7 @@ Database
 information_schema
 mtr
 mysql
+performance_schema
 test
 show databases where `database` = 't%';
 Database
@@ -359,6 +362,7 @@ c
 information_schema
 mtr
 mysql
+performance_schema
 test
 explain select * from v0;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra

=== modified file 'mysql-test/r/ps_1general.result'
--- a/mysql-test/r/ps_1general.result	2009-04-01 08:58:55 +0000
+++ b/mysql-test/r/ps_1general.result	2009-09-30 08:43:17 +0000
@@ -262,6 +262,7 @@ Database
 information_schema
 mtr
 mysql
+performance_schema
 test
 prepare stmt4 from ' show tables from test like ''t2%'' ';
 execute stmt4;

=== modified file 'mysql-test/r/schema.result'
--- a/mysql-test/r/schema.result	2008-04-02 08:06:36 +0000
+++ b/mysql-test/r/schema.result	2009-09-30 08:43:17 +0000
@@ -9,5 +9,6 @@ information_schema
 foo
 mtr
 mysql
+performance_schema
 test
 drop schema foo;

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2009-07-01 12:36:40 +0000
+++ b/mysql-test/r/show_check.result	2009-09-30 08:43:17 +0000
@@ -142,6 +142,7 @@ Database
 information_schema
 mtr
 mysql
+performance_schema
 test
 show databases like "test%";
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr

=== modified file 'mysql-test/suite/binlog/r/binlog_database.result'
--- a/mysql-test/suite/binlog/r/binlog_database.result	2009-05-31 05:44:41 +0000
+++ b/mysql-test/suite/binlog/r/binlog_database.result	2009-09-30 08:43:17 +0000
@@ -116,4 +116,5 @@ Database
 information_schema
 mtr
 mysql
+performance_schema
 test

=== modified file 'mysql-test/suite/jp/r/jp_create_db_sjis.result'
--- a/mysql-test/suite/jp/r/jp_create_db_sjis.result	2009-09-09 13:49:33 +0000
+++ b/mysql-test/suite/jp/r/jp_create_db_sjis.result	2009-09-30 08:43:17 +0000
@@ -13,6 +13,7 @@ information_schema
 ��
 SE `��`;

=== modified file 'mysql-test/suite/jp/r/jp_create_db_ucs2.result'
--- a/mysql-test/suite/jp/r/jp_create_db_ucs2.result	2009-09-09 13:49:33 +0000
+++ b/mysql-test/suite/jp/r/jp_create_db_ucs2.result	2009-09-30 08:43:17 +0000
@@ -14,6 +14,7 @@ information_schema
 ��USE `�ƎΎݎ���;
 USE `����

=== modified file 'mysql-test/suite/jp/r/jp_create_db_ujis.result'
--- a/mysql-test/suite/jp/r/jp_create_db_ujis.result	2009-09-09 13:49:33 +0000
+++ b/mysql-test/suite/jp/r/jp_create_db_ujis.result	2009-09-30 08:43:17 +0000
@@ -13,6 +13,7 @@ information_schema
 ���� �ƎΎݎ��� mysql
+performance_schema
 test
 USE `�ƎΎݎ���;
 USE `����

=== modified file 'mysql-test/suite/jp/r/jp_create_db_utf8.result'
--- a/mysql-test/suite/jp/r/jp_create_db_utf8.result	2009-09-09 13:49:33 +0000
+++ b/mysql-test/suite/jp/r/jp_create_db_utf8.result	2009-09-30 08:43:17 +0000
@@ -13,6 +13,7 @@ information_schema
 龔龖龗
 ニホンゴ
 mysql
+performance_schema
 test
 USE `ニホンゴ`;
 USE `日本語`;

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2009-09-22 16:22:25 +0000
+++ b/sql/sql_plugin.cc	2009-09-30 08:43:17 +0000
@@ -111,7 +111,7 @@ static bool initialized= 0;
   following variables/structures.
   We are always manipulating ref count, so a rwlock here is unneccessary.
 */
-pthread_mutex_t LOCK_plugin;
+mysql_mutex_t LOCK_plugin;
 static DYNAMIC_ARRAY plugin_dl_array;
 static DYNAMIC_ARRAY plugin_array;
 static HASH plugin_hash[MYSQL_MAX_PLUGIN_TYPE_NUM];
@@ -535,7 +535,7 @@ static void plugin_dl_del(const LEX_STRI
   uint i;
   DBUG_ENTER("plugin_dl_del");
 
-  safe_mutex_assert_owner(&LOCK_plugin);
+  mysql_mutex_assert_owner(&LOCK_plugin);
 
   for (i= 0; i < plugin_dl_array.elements; i++)
   {
@@ -567,7 +567,7 @@ static struct st_plugin_int *plugin_find
   if (! initialized)
     DBUG_RETURN(0);
 
-  safe_mutex_assert_owner(&LOCK_plugin);
+  mysql_mutex_assert_owner(&LOCK_plugin);
 
   if (type == MYSQL_ANY_PLUGIN)
   {
@@ -591,14 +591,14 @@ static SHOW_COMP_OPTION plugin_status(co
   SHOW_COMP_OPTION rc= SHOW_OPTION_NO;
   struct st_plugin_int *plugin;
   DBUG_ENTER("plugin_is_ready");
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   if ((plugin= plugin_find_internal(name, type)))
   {
     rc= SHOW_OPTION_DISABLED;
     if (plugin->state == PLUGIN_IS_READY)
       rc= SHOW_OPTION_YES;
   }
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   DBUG_RETURN(rc);
 }
 
@@ -624,7 +624,7 @@ static plugin_ref intern_plugin_lock(LEX
   st_plugin_int *pi= plugin_ref_to_int(rc);
   DBUG_ENTER("intern_plugin_lock");
 
-  safe_mutex_assert_owner(&LOCK_plugin);
+  mysql_mutex_assert_owner(&LOCK_plugin);
 
   if (pi->state & (PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED))
   {
@@ -663,9 +663,9 @@ plugin_ref plugin_lock(THD *thd, plugin_
   LEX *lex= thd ? thd->lex : 0;
   plugin_ref rc;
   DBUG_ENTER("plugin_lock");
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   rc= my_intern_plugin_lock_ci(lex, *ptr);
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   DBUG_RETURN(rc);
 }
 
@@ -677,10 +677,10 @@ plugin_ref plugin_lock_by_name(THD *thd,
   plugin_ref rc= NULL;
   st_plugin_int *plugin;
   DBUG_ENTER("plugin_lock_by_name");
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   if ((plugin= plugin_find_internal(name, type)))
     rc= my_intern_plugin_lock_ci(lex, plugin_int_to_ref(plugin));
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   DBUG_RETURN(rc);
 }
 
@@ -801,7 +801,7 @@ static void plugin_deinitialize(struct s
     deinitialization to deadlock if plugins have worker threads
     with plugin locks
   */
-  safe_mutex_assert_not_owner(&LOCK_plugin);
+  mysql_mutex_assert_not_owner(&LOCK_plugin);
 
   if (plugin->plugin->status_vars)
   {
@@ -855,7 +855,7 @@ static void plugin_deinitialize(struct s
 static void plugin_del(struct st_plugin_int *plugin)
 {
   DBUG_ENTER("plugin_del(plugin)");
-  safe_mutex_assert_owner(&LOCK_plugin);
+  mysql_mutex_assert_owner(&LOCK_plugin);
   /* Free allocated strings before deleting the plugin. */
   plugin_vars_free_values(plugin->system_vars);
   hash_delete(&plugin_hash[plugin->plugin->type], (uchar*)plugin);
@@ -888,7 +888,7 @@ static void reap_plugins(void)
   uint count, idx;
   struct st_plugin_int *plugin, **reap, **list;
 
-  safe_mutex_assert_owner(&LOCK_plugin);
+  mysql_mutex_assert_owner(&LOCK_plugin);
 
   if (!reap_needed)
     return;
@@ -909,13 +909,13 @@ static void reap_plugins(void)
     }
   }
 
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
 
   list= reap;
   while ((plugin= *(--list)))
     plugin_deinitialize(plugin, true);
 
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
 
   while ((plugin= *(--reap)))
     plugin_del(plugin);
@@ -929,7 +929,7 @@ static void intern_plugin_unlock(LEX *le
   st_plugin_int *pi;
   DBUG_ENTER("intern_plugin_unlock");
 
-  safe_mutex_assert_owner(&LOCK_plugin);
+  mysql_mutex_assert_owner(&LOCK_plugin);
 
   if (!plugin)
     DBUG_VOID_RETURN;
@@ -982,10 +982,10 @@ void plugin_unlock(THD *thd, plugin_ref
   if (!plugin_dlib(plugin))
     DBUG_VOID_RETURN;
 #endif
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   intern_plugin_unlock(lex, plugin);
   reap_plugins();
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   DBUG_VOID_RETURN;
 }
 
@@ -995,11 +995,11 @@ void plugin_unlock_list(THD *thd, plugin
   LEX *lex= thd ? thd->lex : 0;
   DBUG_ENTER("plugin_unlock_list");
   DBUG_ASSERT(list);
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   while (count--)
     intern_plugin_unlock(lex, *list++);
   reap_plugins();
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   DBUG_VOID_RETURN;
 }
 
@@ -1008,7 +1008,7 @@ static int plugin_initialize(struct st_p
 {
   DBUG_ENTER("plugin_initialize");
 
-  safe_mutex_assert_owner(&LOCK_plugin);
+  mysql_mutex_assert_owner(&LOCK_plugin);
   if (plugin_type_initialize[plugin->plugin->type])
   {
     if ((*plugin_type_initialize[plugin->plugin->type])(plugin))
@@ -1108,6 +1108,26 @@ static inline void convert_underscore_to
       *p= '-';
 }
 
+#ifdef HAVE_PSI_INTERFACE
+static PSI_mutex_key key_LOCK_plugin;
+
+static PSI_mutex_info all_plugin_mutexes[]=
+{
+  { &key_LOCK_plugin, "LOCK_plugin", PSI_FLAG_GLOBAL}
+};
+
+static void init_plugin_psi_keys(void)
+{
+  const char* category= "sql";
+  int count;
+
+  if (PSI_server == NULL)
+    return;
+
+  count= array_elements(all_plugin_mutexes);
+  PSI_server->register_mutex(category, all_plugin_mutexes, count);
+}
+#endif /* HAVE_PSI_INTERFACE */
 
 /*
   The logic is that we first load and initialize all compiled in plugins.
@@ -1130,6 +1150,10 @@ int plugin_init(int *argc, char **argv,
   if (initialized)
     DBUG_RETURN(0);
 
+#ifdef HAVE_PSI_INTERFACE
+  init_plugin_psi_keys();
+#endif
+
   init_alloc_root(&plugin_mem_root, 4096, 4096);
   init_alloc_root(&tmp_root, 4096, 4096);
 
@@ -1138,7 +1162,7 @@ int plugin_init(int *argc, char **argv,
       goto err;
 
 
-  pthread_mutex_init(&LOCK_plugin, MY_MUTEX_INIT_FAST);
+  mysql_mutex_init(key_LOCK_plugin, &LOCK_plugin, MY_MUTEX_INIT_FAST);
 
   if (my_init_dynamic_array(&plugin_dl_array,
                             sizeof(struct st_plugin_dl *),16,16) ||
@@ -1153,7 +1177,7 @@ int plugin_init(int *argc, char **argv,
       goto err;
   }
 
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
 
   initialized= 1;
 
@@ -1208,7 +1232,7 @@ int plugin_init(int *argc, char **argv,
   /* should now be set to MyISAM storage engine */
   DBUG_ASSERT(global_system_variables.table_plugin);
 
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
 
   /* Register all dynamic plugins */
   if (!(flags & PLUGIN_INIT_SKIP_DYNAMIC_LOADING))
@@ -1226,7 +1250,7 @@ int plugin_init(int *argc, char **argv,
     Now we initialize all remaining plugins
   */
 
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   reap= (st_plugin_int **) my_alloca((plugin_array.elements+1) * sizeof(void*));
   *(reap++)= NULL;
 
@@ -1248,15 +1272,15 @@ int plugin_init(int *argc, char **argv,
   */
   while ((plugin_ptr= *(--reap)))
   {
-    pthread_mutex_unlock(&LOCK_plugin);
+    mysql_mutex_unlock(&LOCK_plugin);
     if (plugin_ptr->is_mandatory)
       reaped_mandatory_plugin= TRUE;
     plugin_deinitialize(plugin_ptr, true);
-    pthread_mutex_lock(&LOCK_plugin);
+    mysql_mutex_lock(&LOCK_plugin);
     plugin_del(plugin_ptr);
   }
 
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   my_afree(reap);
   if (reaped_mandatory_plugin)
     goto err;
@@ -1267,7 +1291,7 @@ end:
   DBUG_RETURN(0);
 
 err_unlock:
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
 err:
   free_root(&tmp_root, MYF(0));
   DBUG_RETURN(1);
@@ -1322,7 +1346,7 @@ bool plugin_register_builtin(THD *thd, s
   tmp.name.str= (char *)plugin->name;
   tmp.name.length= strlen(plugin->name);
 
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   mysql_rwlock_wrlock(&LOCK_system_variables_hash);
 
   if (test_plugin_options(thd->mem_root, &tmp, &dummy_argc, NULL))
@@ -1333,7 +1357,7 @@ bool plugin_register_builtin(THD *thd, s
 
 end:
   mysql_rwlock_unlock(&LOCK_system_variables_hash);
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
 
   DBUG_RETURN(result);;
 }
@@ -1397,10 +1421,10 @@ static void plugin_load(MEM_ROOT *tmp_ro
   /*
     there're no other threads running yet, so we don't need a mutex.
     but plugin_add() before is designed to work in multi-threaded
-    environment, and it uses safe_mutex_assert_owner(), so we lock
+    environment, and it uses mysql_mutex_assert_owner(), so we lock
     the mutex here to satisfy the assert
   */
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   while (!(error= read_record_info.read_record(&read_record_info)))
   {
     DBUG_PRINT("info", ("init plugin record"));
@@ -1416,7 +1440,7 @@ static void plugin_load(MEM_ROOT *tmp_ro
                         str_name.c_ptr(), str_dl.c_ptr());
     free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
   }
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   if (error > 0)
     sql_print_error(ER(ER_GET_ERRNO), my_errno);
   end_read_record(&read_record_info);
@@ -1468,7 +1492,7 @@ static bool plugin_load_list(MEM_ROOT *t
         }
 
         dl= name;
-        pthread_mutex_lock(&LOCK_plugin);
+        mysql_mutex_lock(&LOCK_plugin);
         if ((plugin_dl= plugin_dl_add(&dl, REPORT_TO_LOG)))
         {
           for (plugin= plugin_dl->plugins; plugin->info; plugin++)
@@ -1486,11 +1510,11 @@ static bool plugin_load_list(MEM_ROOT *t
       else
       {
         free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
-        pthread_mutex_lock(&LOCK_plugin);
+        mysql_mutex_lock(&LOCK_plugin);
         if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
           goto error;
       }
-      pthread_mutex_unlock(&LOCK_plugin);
+      mysql_mutex_unlock(&LOCK_plugin);
       name.length= dl.length= 0;
       dl.str= NULL; name.str= p= buffer;
       str= &name;
@@ -1511,7 +1535,7 @@ static bool plugin_load_list(MEM_ROOT *t
   }
   DBUG_RETURN(FALSE);
 error:
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   sql_print_error("Couldn't load plugin named '%s' with soname '%s'.",
                   name.str, dl.str);
   DBUG_RETURN(TRUE);
@@ -1527,7 +1551,7 @@ void plugin_shutdown(void)
 
   if (initialized)
   {
-    pthread_mutex_lock(&LOCK_plugin);
+    mysql_mutex_lock(&LOCK_plugin);
 
     reap_needed= true;
 
@@ -1572,7 +1596,7 @@ void plugin_shutdown(void)
       if (plugins[i]->state == PLUGIN_IS_DELETED)
         plugins[i]->state= PLUGIN_IS_DYING;
     }
-    pthread_mutex_unlock(&LOCK_plugin);
+    mysql_mutex_unlock(&LOCK_plugin);
 
     /*
       We loop through all plugins and call deinit() if they have one.
@@ -1593,9 +1617,9 @@ void plugin_shutdown(void)
     /*
       It's perfectly safe not to lock LOCK_plugin, as there're no
       concurrent threads anymore. But some functions called from here
-      use safe_mutex_assert_owner(), so we lock the mutex to satisfy it
+      use mysql_mutex_assert_owner(), so we lock the mutex to satisfy it
     */
-    pthread_mutex_lock(&LOCK_plugin);
+    mysql_mutex_lock(&LOCK_plugin);
 
     /*
       We defer checking ref_counts until after all plugins are deinitialized
@@ -1616,10 +1640,10 @@ void plugin_shutdown(void)
 
     cleanup_variables(NULL, &global_system_variables);
     cleanup_variables(NULL, &max_system_variables);
-    pthread_mutex_unlock(&LOCK_plugin);
+    mysql_mutex_unlock(&LOCK_plugin);
 
     initialized= 0;
-    pthread_mutex_destroy(&LOCK_plugin);
+    mysql_mutex_destroy(&LOCK_plugin);
 
     my_afree(plugins);
   }
@@ -1667,7 +1691,7 @@ bool mysql_install_plugin(THD *thd, cons
   if (! (table = open_ltable(thd, &tables, TL_WRITE, 0)))
     DBUG_RETURN(TRUE);
 
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   mysql_rwlock_wrlock(&LOCK_system_variables_hash);
 
   my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL);
@@ -1714,14 +1738,14 @@ bool mysql_install_plugin(THD *thd, cons
     goto deinit;
   }
 
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   DBUG_RETURN(FALSE);
 deinit:
   tmp->state= PLUGIN_IS_DELETED;
   reap_needed= true;
   reap_plugins();
 err:
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   DBUG_RETURN(TRUE);
 }
 
@@ -1741,7 +1765,7 @@ bool mysql_uninstall_plugin(THD *thd, co
   if (! (table= open_ltable(thd, &tables, TL_WRITE, 0)))
     DBUG_RETURN(TRUE);
 
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   if (!(plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN)))
   {
     my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PLUGIN", name->str);
@@ -1762,7 +1786,7 @@ bool mysql_uninstall_plugin(THD *thd, co
   else
     reap_needed= true;
   reap_plugins();
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
 
   table->use_all_columns();
   table->field[0]->store(name->str, name->length, system_charset_info);
@@ -1788,7 +1812,7 @@ bool mysql_uninstall_plugin(THD *thd, co
   }
   DBUG_RETURN(FALSE);
 err:
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   DBUG_RETURN(TRUE);
 }
 
@@ -1806,7 +1830,7 @@ bool plugin_foreach_with_mask(THD *thd,
 
   state_mask= ~state_mask; // do it only once
 
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   total= type == MYSQL_ANY_PLUGIN ? plugin_array.elements
                                   : plugin_hash[type].records;
   /*
@@ -1831,17 +1855,17 @@ bool plugin_foreach_with_mask(THD *thd,
       plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL;
     }
   }
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
 
   for (idx= 0; idx < total; idx++)
   {
     if (unlikely(version != plugin_array_version))
     {
-      pthread_mutex_lock(&LOCK_plugin);
+      mysql_mutex_lock(&LOCK_plugin);
       for (uint i=idx; i < total; i++)
         if (plugins[i] && plugins[i]->state & state_mask)
           plugins[i]=0;
-      pthread_mutex_unlock(&LOCK_plugin);
+      mysql_mutex_unlock(&LOCK_plugin);
     }
     plugin= plugins[idx];
     /* It will stop iterating on first engine error when "func" returns TRUE */
@@ -2162,7 +2186,7 @@ sys_var *find_sys_var(THD *thd, const ch
   plugin_ref plugin;
   DBUG_ENTER("find_sys_var");
 
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
   mysql_rwlock_rdlock(&LOCK_system_variables_hash);
   if ((var= intern_find_sys_var(str, length, false)) &&
       (pi= var->cast_pluginvar()))
@@ -2181,7 +2205,7 @@ sys_var *find_sys_var(THD *thd, const ch
   }
   else
     mysql_rwlock_unlock(&LOCK_system_variables_hash);
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
 
   /*
     If the variable exists but the plugin it is associated with is not ready
@@ -2445,11 +2469,11 @@ void plugin_thdvar_init(THD *thd)
   thd->variables.dynamic_variables_size= 0;
   thd->variables.dynamic_variables_ptr= 0;
 
-  pthread_mutex_lock(&LOCK_plugin);  
+  mysql_mutex_lock(&LOCK_plugin);  
   thd->variables.table_plugin=
         my_intern_plugin_lock(NULL, global_system_variables.table_plugin);
   intern_plugin_unlock(NULL, old_table_plugin);
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
   DBUG_VOID_RETURN;
 }
 
@@ -2515,7 +2539,7 @@ void plugin_thdvar_cleanup(THD *thd)
   plugin_ref *list;
   DBUG_ENTER("plugin_thdvar_cleanup");
 
-  pthread_mutex_lock(&LOCK_plugin);
+  mysql_mutex_lock(&LOCK_plugin);
 
   unlock_variables(thd, &thd->variables);
   cleanup_variables(thd, &thd->variables);
@@ -2529,7 +2553,7 @@ void plugin_thdvar_cleanup(THD *thd)
   }
 
   reap_plugins();
-  pthread_mutex_unlock(&LOCK_plugin);
+  mysql_mutex_unlock(&LOCK_plugin);
 
   reset_dynamic(&thd->lex->plugins);
 

Attachment: [text/bzr-bundle] bzr/marc.alff@sun.com-20090930084317-g7k0zf3pd631rxlz.bundle
Thread
bzr commit into mysql-trunk-perfschema branch (marc.alff:2898) WL#2360Marc Alff30 Sep