List:Commits« Previous MessageNext Message »
From:Marc Alff Date:October 15 2008 4:01am
Subject:bzr push into mysql-6.0-perf branch (marc.alff:2703 to 2704)
View as plain text  
 2704 Marc Alff	2008-10-14
      Instrumentation for maria, continued
modified:
  include/maria.h
  storage/maria/ha_maria.cc
  storage/maria/ma_bitmap.c
  storage/maria/ma_check.c
  storage/maria/ma_checkpoint.c
  storage/maria/ma_init.c
  storage/maria/ma_loghandler.c
  storage/maria/ma_open.c
  storage/maria/ma_pagecache.c
  storage/maria/ma_static.c
  storage/maria/maria_def.h
  storage/maria/tablockman.c
  storage/maria/trnman.c

 2703 Marc Alff	2008-10-14
      Instrumentation for myisammrg
modified:
  storage/myisammrg/ha_myisammrg.cc
  storage/myisammrg/myrg_close.c
  storage/myisammrg/myrg_def.h
  storage/myisammrg/myrg_open.c
  storage/myisammrg/myrg_static.c

=== modified file 'include/maria.h'
--- a/include/maria.h	2008-10-10 20:34:55 +0000
+++ b/include/maria.h	2008-10-15 03:57:32 +0000
@@ -176,7 +176,7 @@ typedef struct st_maria_keydef          
 {
   struct st_maria_share *share;         /* Pointer to base (set in open) */
 #ifdef THREAD
-  rw_lock_t root_lock;                  /* locking of tree */
+  mysql_rwlock_t root_lock;                  /* locking of tree */
 #endif
   uint16 keysegs;                       /* Number of key-segment */
   uint16 flag;                          /* NOSAME, PACK_USED */

=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2008-10-10 20:34:55 +0000
+++ b/storage/maria/ha_maria.cc	2008-10-15 03:57:32 +0000
@@ -2958,6 +2958,11 @@ static int ha_maria_init(void *p)
 {
   int res;
   const char *log_dir= maria_data_root;
+
+#ifdef HAVE_PSI_INTERFACE
+  init_maria_psi_keys();
+#endif
+
   maria_hton= (handlerton *)p;
   maria_hton->state= SHOW_OPTION_YES;
   maria_hton->db_type= DB_TYPE_UNKNOWN;

=== modified file 'storage/maria/ma_bitmap.c'
--- a/storage/maria/ma_bitmap.c	2008-10-10 20:34:55 +0000
+++ b/storage/maria/ma_bitmap.c	2008-10-15 03:57:32 +0000
@@ -235,8 +235,10 @@ my_bool _ma_bitmap_init(MARIA_SHARE *sha
   bitmap->sizes[6]= max_page_size - max_page_size * 80 / 100;
   bitmap->sizes[7]= 0;
 
-  pthread_mutex_init(&share->bitmap.bitmap_lock, MY_MUTEX_INIT_SLOW);
-  pthread_cond_init(&share->bitmap.bitmap_cond, 0);
+  MYSQL_MUTEX_INIT(&share->bitmap.bitmap_lock,
+                   key_MARIA_FILE_BITMAP_bitmap_lock, MY_MUTEX_INIT_SLOW);
+  MYSQL_COND_INIT(&share->bitmap.bitmap_cond,
+                  key_MARIA_FILE_BITMAP_bitmap_cond, 0);
 
   _ma_bitmap_reset_cache(share);
 

=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c	2008-10-10 20:34:55 +0000
+++ b/storage/maria/ma_check.c	2008-10-15 03:57:32 +0000
@@ -4043,8 +4043,8 @@ int maria_repair_parallel(HA_CHECK *para
   DBUG_PRINT("info", ("is quick repair: %d", (int) rep_quick));
 
   /* Initialize pthread structures before goto err. */
-  pthread_mutex_init(&sort_info.mutex, MY_MUTEX_INIT_FAST);
-  pthread_cond_init(&sort_info.cond, 0);
+  MYSQL_MUTEX_INIT(&sort_info.mutex, key_MARIA_SORT_INFO_mutex, MY_MUTEX_INIT_FAST);
+  MYSQL_COND_INIT(&sort_info.cond, key_MARIA_SORT_INFO_cond, 0);
 
   if (!(sort_info.key_block=
 	alloc_key_blocks(param, (uint) param->sort_key_blocks,

=== modified file 'storage/maria/ma_checkpoint.c'
--- a/storage/maria/ma_checkpoint.c	2008-10-10 20:34:55 +0000
+++ b/storage/maria/ma_checkpoint.c	2008-10-15 03:57:32 +0000
@@ -328,8 +328,8 @@ int ma_checkpoint_init(ulong interval)
   DBUG_ENTER("ma_checkpoint_init");
   checkpoint_inited= TRUE;
   checkpoint_thread_die= 2; /* not yet born == dead */
-  if (pthread_mutex_init(&LOCK_checkpoint, MY_MUTEX_INIT_SLOW) ||
-      pthread_cond_init(&COND_checkpoint, 0))
+  if (MYSQL_MUTEX_INIT(&LOCK_checkpoint, key_LOCK_checkpoint, MY_MUTEX_INIT_SLOW) ||
+      MYSQL_COND_INIT(&COND_checkpoint, key_COND_checkpoint, 0))
     res= 1;
   else if (interval > 0)
   {

=== modified file 'storage/maria/ma_init.c'
--- a/storage/maria/ma_init.c	2008-10-10 20:34:55 +0000
+++ b/storage/maria/ma_init.c	2008-10-15 03:57:32 +0000
@@ -61,7 +61,7 @@ int maria_init(void)
   if (!maria_inited)
   {
     maria_inited= TRUE;
-    pthread_mutex_init(&THR_LOCK_maria,MY_MUTEX_INIT_SLOW);
+    MYSQL_MUTEX_INIT(&THR_LOCK_maria, key_THR_LOCK_maria, MY_MUTEX_INIT_SLOW);
     _ma_init_block_record_data();
     trnman_end_trans_hook= _ma_trnman_end_trans_hook;
     my_handler_error_register();

=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c	2008-10-10 20:34:55 +0000
+++ b/storage/maria/ma_loghandler.c	2008-10-15 03:57:32 +0000
@@ -1414,14 +1414,16 @@ static my_bool translog_buffer_init(stru
   /* Buffer size */
   buffer->size= 0;
   /* cond of thread which is waiting for buffer filling */
-  if (pthread_cond_init(&buffer->waiting_filling_buffer, 0))
+  if (MYSQL_COND_INIT(&buffer->waiting_filling_buffer,
+                      key_translog_buffer_waiting_filling_buffer, 0))
     DBUG_RETURN(1);
   /* Number of records which are in copy progress */
   buffer->copy_to_buffer_in_progress= 0;
   /* list of waiting buffer ready threads */
   buffer->waiting_flush= 0;
   /* lock for the buffer. Current buffer also lock the handler */
-  if (pthread_mutex_init(&buffer->mutex, MY_MUTEX_INIT_FAST))
+  if (MYSQL_MUTEX_INIT(&buffer->mutex,
+                       key_translog_buffer_mutex, MY_MUTEX_INIT_FAST))
     DBUG_RETURN(1);
   buffer->is_closing_buffer= 0;
   buffer->ver= 0;
@@ -3415,21 +3417,30 @@ my_bool translog_init_with_table(const c
     log_descriptor.open_flags= O_BINARY | O_RDONLY;
   else
     log_descriptor.open_flags= O_BINARY | O_RDWR;
-  if (pthread_mutex_init(&log_descriptor.sent_to_disk_lock,
-                         MY_MUTEX_INIT_FAST) ||
-      pthread_mutex_init(&log_descriptor.file_header_lock,
-                         MY_MUTEX_INIT_FAST) ||
-      pthread_mutex_init(&log_descriptor.unfinished_files_lock,
-                         MY_MUTEX_INIT_FAST) ||
-      pthread_mutex_init(&log_descriptor.purger_lock,
-                         MY_MUTEX_INIT_FAST) ||
-      pthread_mutex_init(&log_descriptor.log_flush_lock,
-                         MY_MUTEX_INIT_FAST) ||
-      pthread_mutex_init(&log_descriptor.dirty_buffer_mask_lock,
-                         MY_MUTEX_INIT_FAST) ||
-      pthread_cond_init(&log_descriptor.log_flush_cond, 0) ||
-      my_rwlock_init(&log_descriptor.open_files_lock,
-                     NULL) ||
+  if (MYSQL_MUTEX_INIT(&log_descriptor.sent_to_disk_lock,
+                       key_translog_descriptor_sent_to_disk_lock,
+                       MY_MUTEX_INIT_FAST) ||
+      MYSQL_MUTEX_INIT(&log_descriptor.file_header_lock,
+                       key_translog_descriptor_file_header_lock,
+                       MY_MUTEX_INIT_FAST) ||
+      MYSQL_MUTEX_INIT(&log_descriptor.unfinished_files_lock,
+                       key_translog_descriptor_unfinished_files_lock,
+                       MY_MUTEX_INIT_FAST) ||
+      MYSQL_MUTEX_INIT(&log_descriptor.purger_lock,
+                       key_translog_descriptor_purger_lock,
+                       MY_MUTEX_INIT_FAST) ||
+      MYSQL_MUTEX_INIT(&log_descriptor.log_flush_lock,
+                       key_translog_descriptor_log_flush_lock,
+                       MY_MUTEX_INIT_FAST) ||
+      MYSQL_MUTEX_INIT(&log_descriptor.dirty_buffer_mask_lock,
+                       key_translog_descriptor_dirty_buffer_mask_lock,
+                       MY_MUTEX_INIT_FAST) ||
+      MYSQL_COND_INIT(&log_descriptor.log_flush_cond,
+                      key_translog_descriptor_log_flush_cond,
+                      0) ||
+      MYSQL_RWLOCK_INIT(&log_descriptor.open_files_lock,
+                       key_translog_descriptor_open_files_lock,
+                       NULL) ||
       my_init_dynamic_array(&log_descriptor.open_files,
                             sizeof(TRANSLOG_FILE*), 10, 10) ||
       my_init_dynamic_array(&log_descriptor.unfinished_files,

=== modified file 'storage/maria/ma_open.c'
--- a/storage/maria/ma_open.c	2008-10-10 20:34:55 +0000
+++ b/storage/maria/ma_open.c	2008-10-15 03:57:32 +0000
@@ -807,11 +807,15 @@ MARIA_HA *maria_open(const char *name, i
     }
 #ifdef THREAD
     thr_lock_init(&share->lock);
-    (void)(pthread_mutex_init(&share->intern_lock, MY_MUTEX_INIT_FAST));
-    (void)(pthread_cond_init(&share->intern_cond, 0));
+    (void)(MYSQL_MUTEX_INIT(&share->intern_lock,
+                            key_MARIA_SHARE_intern_lock, MY_MUTEX_INIT_FAST));
+    (void)(MYSQL_COND_INIT(&share->intern_cond,
+                           key_MARIA_SHARE_intern_cond, 0));
     for (i=0; i<keys; i++)
-      (void)(my_rwlock_init(&share->keyinfo[i].root_lock, NULL));
-    (void)(my_rwlock_init(&share->mmap_lock, NULL));
+      (void)(MYSQL_RWLOCK_INIT(&share->keyinfo[i].root_lock,
+                               key_MARIA_KEYDEF_root_lock, NULL));
+    (void)(MYSQL_RWLOCK_INIT(&share->mmap_lock,
+                             key_MARIA_SHARE_mmap_lock, NULL));
 
     share->row_is_visible= _ma_row_visible_always;
     if (!thr_lock_inited)

=== modified file 'storage/maria/ma_pagecache.c'
--- a/storage/maria/ma_pagecache.c	2008-08-25 18:29:05 +0000
+++ b/storage/maria/ma_pagecache.c	2008-10-15 03:57:32 +0000
@@ -127,7 +127,7 @@ my_bool my_disable_flush_pagecache_block
 #define  COND_FOR_WRLOCK    2  /* queue of write lock */
 #define  COND_SIZE          3  /* number of COND_* queues */
 
-typedef pthread_cond_t KEYCACHE_CONDVAR;
+typedef mysql_cond_t KEYCACHE_CONDVAR;
 
 /* descriptor of the page in the page cache block buffer */
 struct st_pagecache_page
@@ -553,29 +553,29 @@ static long pagecache_thread_id;
            sizeof(PAGECACHE_HASH_LINK)))
 
 #if (defined(PAGECACHE_TIMEOUT) && !defined(__WIN__)) || defined(PAGECACHE_DEBUG)
-static int pagecache_pthread_cond_wait(pthread_cond_t *cond,
-                                      pthread_mutex_t *mutex);
+static int pagecache_cond_wait(mysql_cond_t *cond,
+                               mysql_mutex_t *mutex);
 #else
-#define  pagecache_pthread_cond_wait pthread_cond_wait
+#define  pagecache_cond_wait(C,M) MYSQL_COND_WAIT(C,M)
 #endif
 
 #if defined(PAGECACHE_DEBUG)
-static int ___pagecache_pthread_mutex_lock(pthread_mutex_t *mutex);
-static void ___pagecache_pthread_mutex_unlock(pthread_mutex_t *mutex);
-static int ___pagecache_pthread_cond_signal(pthread_cond_t *cond);
-#define pagecache_pthread_mutex_lock(M) \
+static int ___pagecache_mutex_lock(mysql_mutex_t *mutex);
+static void ___pagecache_mutex_unlock(mysql_mutex_t *mutex);
+static int ___pagecache_cond_signal(mysql_cond_t *cond);
+#define pagecache_mutex_lock(M) \
 { DBUG_PRINT("lock", ("mutex lock 0x%lx %u", (ulong)(M), __LINE__)); \
-  ___pagecache_pthread_mutex_lock(M);}
-#define pagecache_pthread_mutex_unlock(M) \
+  ___pagecache_mutex_lock(M);}
+#define pagecache_mutex_unlock(M) \
 { DBUG_PRINT("lock", ("mutex unlock 0x%lx %u", (ulong)(M), __LINE__)); \
-  ___pagecache_pthread_mutex_unlock(M);}
-#define pagecache_pthread_cond_signal(M) \
+  ___pagecache_mutex_unlock(M);}
+#define pagecache_cond_signal(M) \
 { DBUG_PRINT("lock", ("signal 0x%lx %u", (ulong)(M), __LINE__)); \
-  ___pagecache_pthread_cond_signal(M);}
+  ___pagecache_cond_signal(M);}
 #else
-#define pagecache_pthread_mutex_lock pthread_mutex_lock
-#define pagecache_pthread_mutex_unlock pthread_mutex_unlock
-#define pagecache_pthread_cond_signal pthread_cond_signal
+#define pagecache_mutex_lock(M) MYSQL_MUTEX_LOCK(M)
+#define pagecache_mutex_unlock(M) MYSQL_MUTEX_UNLOCK(M)
+#define pagecache_cond_signal(C) MYSQL_COND_SIGNAL(C)
 #endif /* defined(PAGECACHE_DEBUG) */
 
 extern my_bool translog_flush(TRANSLOG_ADDRESS lsn);
@@ -721,7 +721,8 @@ ulong init_pagecache(PAGECACHE *pagecach
   pagecache->disk_blocks= -1;
   if (! pagecache->inited)
   {
-    if (pthread_mutex_init(&pagecache->cache_lock, MY_MUTEX_INIT_FAST) ||
+    if (MYSQL_MUTEX_INIT(&pagecache->cache_lock,
+                         key_PAGECACHE_cache_lock, MY_MUTEX_INIT_FAST) ||
         hash_init(&pagecache->files_in_flush, &my_charset_bin, 32,
                   offsetof(struct st_file_in_flush, file),
                   sizeof(((struct st_file_in_flush *)NULL)->file),
@@ -955,7 +956,7 @@ ulong resize_pagecache(PAGECACHE *pageca
     DBUG_RETURN(pagecache->disk_blocks);
   }
 
-  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+  pagecache_mutex_lock(&pagecache->cache_lock);
 
 #ifdef THREAD
   wqueue= &pagecache->resize_queue;
@@ -964,7 +965,7 @@ ulong resize_pagecache(PAGECACHE *pageca
 
   while (wqueue->last_thread->next != thread)
   {
-    pagecache_pthread_cond_wait(&thread->suspend, &pagecache->cache_lock);
+    pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
   }
 #endif
 
@@ -984,7 +985,7 @@ ulong resize_pagecache(PAGECACHE *pageca
   {
     KEYCACHE_DBUG_PRINT("resize_pagecache: wait",
                         ("suspend thread %ld", thread->id));
-    pagecache_pthread_cond_wait(&thread->suspend, &pagecache->cache_lock);
+    pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
   }
 #else
   KEYCACHE_DBUG_ASSERT(pagecache->cnt_for_resize_op == 0);
@@ -1004,10 +1005,10 @@ finish:
   {
     KEYCACHE_DBUG_PRINT("resize_pagecache: signal",
                         ("thread %ld", wqueue->last_thread->next->id));
-    pagecache_pthread_cond_signal(&wqueue->last_thread->next->suspend);
+    pagecache_cond_signal(&wqueue->last_thread->next->suspend);
   }
 #endif
-  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+  pagecache_mutex_unlock(&pagecache->cache_lock);
   DBUG_RETURN(blocks);
 }
 #endif /* 0 */
@@ -1035,7 +1036,7 @@ static inline void dec_counter_for_resiz
   {
     KEYCACHE_DBUG_PRINT("dec_counter_for_resize_op: signal",
                         ("thread %ld", last_thread->next->id));
-    pagecache_pthread_cond_signal(&last_thread->next->suspend);
+    pagecache_cond_signal(&last_thread->next->suspend);
   }
 #else
   pagecache->cnt_for_resize_op--;
@@ -1065,14 +1066,14 @@ void change_pagecache_param(PAGECACHE *p
 {
   DBUG_ENTER("change_pagecache_param");
 
-  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+  pagecache_mutex_lock(&pagecache->cache_lock);
   if (division_limit)
     pagecache->min_warm_blocks= (pagecache->disk_blocks *
 				division_limit / 100 + 1);
   if (age_threshold)
     pagecache->age_threshold=   (pagecache->disk_blocks *
 				age_threshold / 100);
-  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+  pagecache_mutex_unlock(&pagecache->cache_lock);
   DBUG_VOID_RETURN;
 }
 
@@ -1123,7 +1124,7 @@ void end_pagecache(PAGECACHE *pagecache,
   if (cleanup)
   {
     hash_free(&pagecache->files_in_flush);
-    pthread_mutex_destroy(&pagecache->cache_lock);
+    MYSQL_MUTEX_DESTROY(&pagecache->cache_lock);
     pagecache->inited= pagecache->can_be_used= 0;
     PAGECACHE_DEBUG_CLOSE;
   }
@@ -1262,7 +1263,7 @@ static void link_block(PAGECACHE *pageca
       if ((PAGECACHE_HASH_LINK *) thread->opt_info == hash_link)
       {
         KEYCACHE_DBUG_PRINT("link_block: signal", ("thread: %ld", thread->id));
-        pagecache_pthread_cond_signal(&thread->suspend);
+        pagecache_cond_signal(&thread->suspend);
         wqueue_unlink_from_queue(&pagecache->waiting_for_block, thread);
         block->requests++;
       }
@@ -1481,7 +1482,7 @@ static inline void remove_reader(PAGECAC
   DBUG_ASSERT(block->hash_link->requests > 0);
 #ifdef THREAD
   if (! --block->hash_link->requests && block->condvar)
-    pagecache_pthread_cond_signal(block->condvar);
+    pagecache_cond_signal(block->condvar);
 #else
   --block->hash_link->requests;
 #endif
@@ -1506,7 +1507,7 @@ static inline void wait_for_readers(PAGE
                         ("suspend thread: %ld  block: %u",
                          thread->id, PCBLOCK_NUMBER(pagecache, block)));
     block->condvar= &thread->suspend;
-    pagecache_pthread_cond_wait(&thread->suspend, &pagecache->cache_lock);
+    pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
     block->condvar= NULL;
   }
 #else
@@ -1571,7 +1572,7 @@ static void unlink_hash(PAGECACHE *pagec
           page->pageno == hash_link->pageno)
       {
         KEYCACHE_DBUG_PRINT("unlink_hash: signal", ("thread %ld", thread->id));
-        pagecache_pthread_cond_signal(&thread->suspend);
+        pagecache_cond_signal(&thread->suspend);
         wqueue_unlink_from_queue(&pagecache->waiting_for_hash_link, thread);
       }
     }
@@ -1707,8 +1708,7 @@ restart:
       wqueue_link_into_queue(&pagecache->waiting_for_hash_link, thread);
       KEYCACHE_DBUG_PRINT("get_hash_link: wait",
                         ("suspend thread %ld", thread->id));
-      pagecache_pthread_cond_wait(&thread->suspend,
-                                 &pagecache->cache_lock);
+      pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
       thread->opt_info= NULL;
 #else
       KEYCACHE_DBUG_ASSERT(0);
@@ -1840,8 +1840,7 @@ restart:
       {
         KEYCACHE_DBUG_PRINT("find_block: wait",
                             ("suspend thread %ld", thread->id));
-        pagecache_pthread_cond_wait(&thread->suspend,
-                                   &pagecache->cache_lock);
+        pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
       }
       while(thread->next);
 #else
@@ -1896,8 +1895,7 @@ restart:
         {
           KEYCACHE_DBUG_PRINT("find_block: wait",
                               ("suspend thread %ld", thread->id));
-          pagecache_pthread_cond_wait(&thread->suspend,
-                                     &pagecache->cache_lock);
+          pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
         }
         while(thread->next);
 #else
@@ -1981,8 +1979,7 @@ restart:
           {
             KEYCACHE_DBUG_PRINT("find_block: wait",
                                 ("suspend thread %ld", thread->id));
-            pagecache_pthread_cond_wait(&thread->suspend,
-                                       &pagecache->cache_lock);
+            pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
           }
           while (thread->next);
           thread->opt_info= NULL;
@@ -2030,7 +2027,7 @@ restart:
 
             KEYCACHE_DBUG_PRINT("find_block", ("block is dirty"));
 
-            pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+            pagecache_mutex_unlock(&pagecache->cache_lock);
             /*
 	      The call is thread safe because only the current
 	      thread might change the block->hash_link value
@@ -2042,7 +2039,7 @@ restart:
                                     block->hash_link->pageno,
                                     block->type,
                                     pagecache->readwrite_flags);
-            pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+            pagecache_mutex_lock(&pagecache->cache_lock);
 	    pagecache->global_cache_write++;
           }
 
@@ -2235,8 +2232,7 @@ static my_bool pagecache_wait_lock(PAGEC
   {
     KEYCACHE_DBUG_PRINT("get_wrlock: wait",
                         ("suspend thread %ld", thread->id));
-    pagecache_pthread_cond_wait(&thread->suspend,
-                                &pagecache->cache_lock);
+    pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
   }
   while(thread->next);
 #else
@@ -2595,7 +2591,7 @@ static void read_block(PAGECACHE *pageca
 
     pagecache->global_cache_read++;
     /* Page is not in buffer yet, is to be read from disk */
-    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+    pagecache_mutex_unlock(&pagecache->cache_lock);
     /*
       Here other threads may step in and register as secondary readers.
       They will register in block->wqueue[COND_FOR_REQUESTED].
@@ -2604,7 +2600,7 @@ static void read_block(PAGECACHE *pageca
                            block->buffer,
                            block->hash_link->pageno,
                            pagecache->readwrite_flags);
-    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+    pagecache_mutex_lock(&pagecache->cache_lock);
     if (error)
     {
       block->status|= PCBLOCK_ERROR;
@@ -2650,8 +2646,7 @@ static void read_block(PAGECACHE *pageca
       {
         DBUG_PRINT("read_block: wait",
                   ("suspend thread %ld", thread->id));
-        pagecache_pthread_cond_wait(&thread->suspend,
-                                   &pagecache->cache_lock);
+        pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
       }
       while (thread->next);
 #else
@@ -2749,7 +2744,7 @@ void pagecache_unlock(PAGECACHE *pagecac
   DBUG_ASSERT(lock != PAGECACHE_LOCK_READ);
   DBUG_ASSERT(lock != PAGECACHE_LOCK_WRITE);
 
-  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+  pagecache_mutex_lock(&pagecache->cache_lock);
   /*
     As soon as we keep lock cache can be used, and we have lock because want
     to unlock.
@@ -2809,7 +2804,7 @@ void pagecache_unlock(PAGECACHE *pagecac
 
   dec_counter_for_resize_op(pagecache);
 
-  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+  pagecache_mutex_unlock(&pagecache->cache_lock);
 
   DBUG_VOID_RETURN;
 }
@@ -2838,7 +2833,7 @@ void pagecache_unpin(PAGECACHE *pagecach
   DBUG_ENTER("pagecache_unpin");
   DBUG_PRINT("enter", ("fd: %u  page: %lu",
                        (uint) file->file, (ulong) pageno));
-  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+  pagecache_mutex_lock(&pagecache->cache_lock);
   /*
     As soon as we keep lock cache can be used, and we have lock bacause want
     aunlock.
@@ -2876,7 +2871,7 @@ void pagecache_unpin(PAGECACHE *pagecach
 
   dec_counter_for_resize_op(pagecache);
 
-  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+  pagecache_mutex_unlock(&pagecache->cache_lock);
 
   DBUG_VOID_RETURN;
 }
@@ -2927,7 +2922,7 @@ void pagecache_unlock_by_link(PAGECACHE 
     DBUG_VOID_RETURN;
   }
 
-  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+  pagecache_mutex_lock(&pagecache->cache_lock);
   /*
     As soon as we keep lock cache can be used, and we have lock because want
     unlock.
@@ -2989,7 +2984,7 @@ void pagecache_unlock_by_link(PAGECACHE 
 
   dec_counter_for_resize_op(pagecache);
 
-  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+  pagecache_mutex_unlock(&pagecache->cache_lock);
 
   DBUG_VOID_RETURN;
 }
@@ -3018,7 +3013,7 @@ void pagecache_unpin_by_link(PAGECACHE *
                        (uint) block->hash_link->file.file,
                        (ulong) block->hash_link->pageno));
 
-  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+  pagecache_mutex_lock(&pagecache->cache_lock);
   /*
     As soon as we keep lock cache can be used, and we have lock because want
     unlock.
@@ -3051,7 +3046,7 @@ void pagecache_unpin_by_link(PAGECACHE *
 
   dec_counter_for_resize_op(pagecache);
 
-  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+  pagecache_mutex_unlock(&pagecache->cache_lock);
 
   DBUG_VOID_RETURN;
 }
@@ -3143,10 +3138,10 @@ restart:
     uint status;
     int page_st;
 
-    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+    pagecache_mutex_lock(&pagecache->cache_lock);
     if (!pagecache->can_be_used)
     {
-      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+      pagecache_mutex_unlock(&pagecache->cache_lock);
       goto no_key_cache;
     }
 
@@ -3198,7 +3193,7 @@ restart:
       */
       if (reg_request)
         unreg_request(pagecache, block, 1);
-      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+      pagecache_mutex_unlock(&pagecache->cache_lock);
       DBUG_PRINT("info", ("restarting..."));
       goto restart;
     }
@@ -3222,7 +3217,7 @@ restart:
       if (!(status & PCBLOCK_ERROR))
       {
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-        pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+        pagecache_mutex_unlock(&pagecache->cache_lock);
 #endif
 
         DBUG_ASSERT((pagecache->block_size & 511) == 0);
@@ -3230,7 +3225,7 @@ restart:
         bmove512(buff, block->buffer, pagecache->block_size);
 
 #if !defined(SERIALIZED_READ_FROM_CACHE)
-        pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+        pagecache_mutex_lock(&pagecache->cache_lock);
 #endif
       }
       else
@@ -3250,7 +3245,7 @@ restart:
 
     dec_counter_for_resize_op(pagecache);
 
-    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+    pagecache_mutex_unlock(&pagecache->cache_lock);
 
     if (status & PCBLOCK_ERROR)
     {
@@ -3301,7 +3296,7 @@ static my_bool pagecache_delete_internal
 
       KEYCACHE_DBUG_PRINT("find_block", ("block is dirty"));
 
-      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+      pagecache_mutex_unlock(&pagecache->cache_lock);
       /*
         The call is thread safe because only the current
         thread might change the block->hash_link value
@@ -3313,7 +3308,7 @@ static my_bool pagecache_delete_internal
                               block->hash_link->pageno,
                               block->type,
                               pagecache->readwrite_flags);
-      pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+      pagecache_mutex_lock(&pagecache->cache_lock);
       pagecache->global_cache_write++;
 
       if (error)
@@ -3382,7 +3377,7 @@ my_bool pagecache_delete_by_link(PAGECAC
 
   if (pagecache->can_be_used)
   {
-    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+    pagecache_mutex_lock(&pagecache->cache_lock);
     if (!pagecache->can_be_used)
       goto end;
 
@@ -3408,7 +3403,7 @@ my_bool pagecache_delete_by_link(PAGECAC
     error= pagecache_delete_internal(pagecache, block, block->hash_link,
                                      flush);
 end:
-    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+    pagecache_mutex_unlock(&pagecache->cache_lock);
   }
 
   DBUG_RETURN(error);
@@ -3487,7 +3482,7 @@ restart:
     reg1 PAGECACHE_BLOCK_LINK *block;
     PAGECACHE_HASH_LINK **unused_start, *page_link;
 
-    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+    pagecache_mutex_lock(&pagecache->cache_lock);
     if (!pagecache->can_be_used)
       goto end;
 
@@ -3496,7 +3491,7 @@ restart:
     if (!page_link)
     {
       DBUG_PRINT("info", ("There is no such page in the cache"));
-      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+      pagecache_mutex_unlock(&pagecache->cache_lock);
       DBUG_RETURN(0);
     }
     block= page_link->block;
@@ -3522,7 +3517,7 @@ restart:
       */
       if (pin == PAGECACHE_PIN)
         unreg_request(pagecache, block, 1);
-      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+      pagecache_mutex_unlock(&pagecache->cache_lock);
       DBUG_PRINT("info", ("restarting..."));
       goto restart;
     }
@@ -3532,7 +3527,7 @@ restart:
 
     error= pagecache_delete_internal(pagecache, block, page_link, flush);
 end:
-    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+    pagecache_mutex_unlock(&pagecache->cache_lock);
   }
 
   DBUG_RETURN(error);
@@ -3692,10 +3687,10 @@ restart:
     /* Key cache is used */
     int page_st;
 
-    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+    pagecache_mutex_lock(&pagecache->cache_lock);
     if (!pagecache->can_be_used)
     {
-      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+      pagecache_mutex_unlock(&pagecache->cache_lock);
       goto no_key_cache;
     }
 
@@ -3715,7 +3710,7 @@ restart:
       DBUG_ASSERT(write_mode != PAGECACHE_WRITE_DONE);
       /* It happens only for requests submitted during resize operation */
       dec_counter_for_resize_op(pagecache);
-      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+      pagecache_mutex_unlock(&pagecache->cache_lock);
       /* Write to the disk key cache is in resize at the moment*/
       goto no_key_cache;
     }
@@ -3744,7 +3739,7 @@ restart:
       */
       if (reg_request)
         unreg_request(pagecache, block, 1);
-      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+      pagecache_mutex_unlock(&pagecache->cache_lock);
       DBUG_PRINT("info", ("restarting..."));
       goto restart;
     }
@@ -3844,7 +3839,7 @@ restart:
 
     dec_counter_for_resize_op(pagecache);
 
-    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+    pagecache_mutex_unlock(&pagecache->cache_lock);
 
     goto end;
   }
@@ -4001,14 +3996,14 @@ static int flush_cached_blocks(PAGECACHE
   *first_errno= 0;
 
   /* Don't lock the cache during the flush */
-  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+  pagecache_mutex_unlock(&pagecache->cache_lock);
   /*
      As all blocks referred in 'cache' are marked by PCBLOCK_IN_FLUSH
      we are guaranteed that no thread will change them
   */
   qsort((uchar*) cache, count, sizeof(*cache), (qsort_cmp) cmp_sec_link);
 
-  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+  pagecache_mutex_lock(&pagecache->cache_lock);
   for (; cache != end; cache++)
   {
     PAGECACHE_BLOCK_LINK *block= *cache;
@@ -4044,7 +4039,7 @@ static int flush_cached_blocks(PAGECACHE
     DBUG_PRINT("info", ("block: %u (0x%lx)  to be flushed",
                         PCBLOCK_NUMBER(pagecache, block), (ulong)block));
     PCBLOCK_INFO(block);
-    pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+    pagecache_mutex_unlock(&pagecache->cache_lock);
     DBUG_PRINT("info", ("block: %u (0x%lx)  pins: %u",
                         PCBLOCK_NUMBER(pagecache, block), (ulong)block,
                         block->pins));
@@ -4064,7 +4059,7 @@ static int flush_cached_blocks(PAGECACHE
                             block->hash_link->pageno,
                             block->type,
                             pagecache->readwrite_flags);
-    pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+    pagecache_mutex_lock(&pagecache->cache_lock);
 
     if (make_lock_and_pin(pagecache, block,
                           PAGECACHE_LOCK_WRITE_UNLOCK,
@@ -4209,8 +4204,7 @@ static int flush_pagecache_blocks_int(PA
       {
         KEYCACHE_DBUG_PRINT("flush_pagecache_blocks_int: wait1",
                             ("suspend thread %ld", thread->id));
-        pagecache_pthread_cond_wait(&thread->suspend,
-                                    &pagecache->cache_lock);
+        pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
       }
       while (thread->next);
     }
@@ -4229,11 +4223,11 @@ static int flush_pagecache_blocks_int(PA
         and thus require a table check.
       */
       DBUG_ASSERT(0);
-      pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+      pagecache_mutex_unlock(&pagecache->cache_lock);
       if (my_thread_var->abort)
         DBUG_RETURN(1);		/* End if aborted by user */
       sleep(10);
-      pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+      pagecache_mutex_lock(&pagecache->cache_lock);
     }
 #endif
 
@@ -4369,8 +4363,7 @@ restart:
         {
           KEYCACHE_DBUG_PRINT("flush_pagecache_blocks_int: wait2",
                               ("suspend thread %ld", thread->id));
-          pagecache_pthread_cond_wait(&thread->suspend,
-                                     &pagecache->cache_lock);
+          pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
         }
         while (thread->next);
 #else
@@ -4469,11 +4462,11 @@ int flush_pagecache_blocks_with_filter(P
 
   if (pagecache->disk_blocks <= 0)
     DBUG_RETURN(0);
-  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+  pagecache_mutex_lock(&pagecache->cache_lock);
   inc_counter_for_resize_op(pagecache);
   res= flush_pagecache_blocks_int(pagecache, file, type, filter, filter_arg);
   dec_counter_for_resize_op(pagecache);
-  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+  pagecache_mutex_unlock(&pagecache->cache_lock);
   DBUG_RETURN(res);
 }
 
@@ -4550,7 +4543,7 @@ my_bool pagecache_collect_changed_blocks
     We lock the entire cache but will be quick, just reading/writing a few MBs
     of memory at most.
   */
-  pagecache_pthread_mutex_lock(&pagecache->cache_lock);
+  pagecache_mutex_lock(&pagecache->cache_lock);
 #ifdef THREAD
   for (;;)
   {
@@ -4580,8 +4573,7 @@ my_bool pagecache_collect_changed_blocks
       {
         KEYCACHE_DBUG_PRINT("pagecache_collect_changed_blocks_with_lsn: wait",
                             ("suspend thread %ld", thread->id));
-        pagecache_pthread_cond_wait(&thread->suspend,
-                                    &pagecache->cache_lock);
+        pagecache_cond_wait(&thread->suspend, &pagecache->cache_lock);
       }
       while (thread->next);
     }
@@ -4659,7 +4651,7 @@ my_bool pagecache_collect_changed_blocks
     }
   }
 end:
-  pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
+  pagecache_mutex_unlock(&pagecache->cache_lock);
   *min_rec_lsn= minimum_rec_lsn;
   DBUG_RETURN(error);
 
@@ -4810,8 +4802,8 @@ static void pagecache_dump(PAGECACHE *pa
 #if defined(PAGECACHE_TIMEOUT) && !defined(__WIN__)
 
 
-static int pagecache_pthread_cond_wait(pthread_cond_t *cond,
-                                      pthread_mutex_t *mutex)
+static int pagecache_cond_wait(mysql_cond_t *cond,
+                               mysql_mutex_t *mutex)
 {
   int rc;
   struct timeval  now;            /* time when we started waiting        */
@@ -4838,7 +4830,7 @@ static int pagecache_pthread_cond_wait(p
     fprintf(pagecache_debug_log, "waiting...\n");
     fflush(pagecache_debug_log);
 #endif
-  rc= pthread_cond_timedwait(cond, mutex, &timeout);
+  rc= MYSQL_COND_TIMEDWAIT(cond, mutex, &timeout);
   KEYCACHE_THREAD_TRACE_BEGIN("finished waiting");
   if (rc == ETIMEDOUT || rc == ETIME)
   {
@@ -4859,12 +4851,12 @@ static int pagecache_pthread_cond_wait(p
 }
 #else
 #if defined(PAGECACHE_DEBUG)
-static int pagecache_pthread_cond_wait(pthread_cond_t *cond,
-                                      pthread_mutex_t *mutex)
+static int pagecache_cond_wait(mysql_cond_t *cond,
+                               mysql_mutex_t *mutex)
 {
   int rc;
   KEYCACHE_THREAD_TRACE_END("started waiting");
-  rc= pthread_cond_wait(cond, mutex);
+  rc= MYSQL_COND_WAIT(cond, mutex);
   KEYCACHE_THREAD_TRACE_BEGIN("finished waiting");
   return rc;
 }
@@ -4872,27 +4864,27 @@ static int pagecache_pthread_cond_wait(p
 #endif /* defined(PAGECACHE_TIMEOUT) && !defined(__WIN__) */
 
 #if defined(PAGECACHE_DEBUG)
-static int ___pagecache_pthread_mutex_lock(pthread_mutex_t *mutex)
+static int ___pagecache_mutex_lock(mysql_mutex_t *mutex)
 {
   int rc;
-  rc= pthread_mutex_lock(mutex);
+  rc= MYSQL_MUTEX_LOCK(mutex);
   KEYCACHE_THREAD_TRACE_BEGIN("");
   return rc;
 }
 
 
-static void ___pagecache_pthread_mutex_unlock(pthread_mutex_t *mutex)
+static void ___pagecache_mutex_unlock(mutex_mutex_t *mutex)
 {
   KEYCACHE_THREAD_TRACE_END("");
-  pthread_mutex_unlock(mutex);
+  MYSQL_MUTEX_UNLOCK(mutex);
 }
 
 
-static int ___pagecache_pthread_cond_signal(pthread_cond_t *cond)
+static int ___pagecache_cond_signal(mysql_cond_t *cond)
 {
   int rc;
   KEYCACHE_THREAD_TRACE("signal");
-  rc= pthread_cond_signal(cond);
+  rc= MYSQL_COND_SIGNAL(cond);
   return rc;
 }
 

=== modified file 'storage/maria/ma_static.c'
--- a/storage/maria/ma_static.c	2008-10-10 20:34:55 +0000
+++ b/storage/maria/ma_static.c	2008-10-15 03:57:32 +0000
@@ -94,3 +94,112 @@ uint32 maria_readnext_vec[]=
   SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER,
   SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER
 };
+
+#ifdef HAVE_PSI_INTERFACE
+PSI_mutex_key key_THR_LOCK_maria;
+PSI_mutex_key key_LOCK_trn_list;
+PSI_mutex_key key_TABLOCKMAN_pool_mutex;
+PSI_mutex_key key_LOCKED_TABLE_mutex;
+PSI_mutex_key key_translog_buffer_mutex;
+PSI_mutex_key key_translog_descriptor_sent_to_disk_lock;
+PSI_mutex_key key_translog_descriptor_file_header_lock;
+PSI_mutex_key key_translog_descriptor_unfinished_files_lock;
+PSI_mutex_key key_translog_descriptor_purger_lock;
+PSI_mutex_key key_translog_descriptor_log_flush_lock;
+PSI_mutex_key key_translog_descriptor_dirty_buffer_mask_lock;
+PSI_mutex_key key_PAGECACHE_cache_lock;
+PSI_mutex_key key_LOCK_checkpoint;
+PSI_rwlock_key key_translog_descriptor_open_files_lock;
+PSI_cond_key key_COND_checkpoint;
+PSI_cond_key key_translog_buffer_waiting_filling_buffer;
+PSI_cond_key key_translog_descriptor_log_flush_cond;
+#ifdef THREAD
+PSI_mutex_key key_MARIA_SHARE_intern_lock;
+PSI_mutex_key key_MARIA_FILE_BITMAP_bitmap_lock;
+PSI_mutex_key key_MARIA_SORT_INFO_mutex;
+PSI_rwlock_key key_MARIA_KEYDEF_root_lock;
+PSI_rwlock_key key_MARIA_SHARE_mmap_lock;
+PSI_cond_key key_MARIA_SHARE_intern_cond;
+PSI_cond_key key_MARIA_FILE_BITMAP_bitmap_cond;
+PSI_cond_key key_MARIA_SORT_INFO_cond;
+#endif
+
+void init_maria_psi_keys()
+{
+  PSI_mutex_key (*reg_mutex)(const char* name, int global);
+  PSI_rwlock_key (*reg_rwlock)(const char* name, int global);
+  PSI_cond_key (*reg_cond)(const char* name, int global);
+  int global= 1;
+
+  if (PSI_server == NULL)
+    return;
+
+  reg_mutex= PSI_server->register_mutex;
+  reg_rwlock= PSI_server->register_rwlock;
+  reg_cond= PSI_server->register_cond;
+
+  /* ALL maria MUTEXES */
+
+  key_THR_LOCK_maria= (*reg_mutex)(
+    "THR_LOCK_maria", global);
+  key_LOCK_trn_list= (*reg_mutex)(
+    "LOCK_trn_list", global);
+  key_TABLOCKMAN_pool_mutex= (*reg_mutex)(
+    "TABLOCKMAN::pool_mutex", global);
+  key_LOCKED_TABLE_mutex= (*reg_mutex)(
+    "LOCKED_TABLE::mutex", global);
+  key_translog_buffer_mutex= (*reg_mutex)(
+    "translog_buffer::mutex", global);
+  key_translog_descriptor_sent_to_disk_lock= (*reg_mutex)(
+    "translog_descriptor::sent_to_disk_lock", global);
+  key_translog_descriptor_file_header_lock= (*reg_mutex)(
+    "translog_descriptor::file_header_lock", global);
+  key_translog_descriptor_unfinished_files_lock= (*reg_mutex)(
+    "translog_descriptor::unfinished_files_lock", global);
+  key_translog_descriptor_purger_lock= (*reg_mutex)(
+    "translog_descriptor::purger_lock", global);
+  key_translog_descriptor_log_flush_lock= (*reg_mutex)(
+    "translog_descriptor::log_flush_lock", global);
+  key_translog_descriptor_dirty_buffer_mask_lock= (*reg_mutex)(
+    "translog_descriptor::dirty_buffer_mask_lock", global);
+  key_PAGECACHE_cache_lock= (*reg_mutex)(
+    "PAGECACHE::cache_lock", global);
+  key_LOCK_checkpoint= (*reg_mutex)(
+    "LOCK_checkpoint", global);
+#ifdef THREAD
+  key_MARIA_SHARE_intern_lock= (*reg_mutex)(
+    "MARIA_SHARE::intern_lock", global);
+  key_MARIA_FILE_BITMAP_bitmap_lock= (*reg_mutex)(
+    "MARIA_FILE_BITMAP::bitmap_lock", global);
+  key_MARIA_SORT_INFO_mutex= (*reg_mutex)(
+    "MARIA_SORT_INFO::mutex", global);
+#endif
+
+  /* ALL maria RWLOCK */
+  key_translog_descriptor_open_files_lock= (*reg_rwlock)(
+    "translog_descriptor::open_files_lock", global);
+#ifdef THREAD
+  key_MARIA_KEYDEF_root_lock= (*reg_rwlock)(
+    "MARIA_KEYDEF::root_lock", global);
+  key_MARIA_SHARE_mmap_lock= (*reg_rwlock)(
+    "MARIA_SHARE::mmap_lock", global);
+#endif
+
+  /* ALL maria COND */
+  key_COND_checkpoint= (*reg_rwlock)(
+    "COND_checkpoint", global);
+  key_translog_buffer_waiting_filling_buffer= (*reg_rwlock)(
+    "translog_buffer::waiting_filling_buffer", global);
+  key_translog_descriptor_log_flush_cond= (*reg_rwlock)(
+    "translog_descriptor::log_flush_cond", global);
+#ifdef THREAD
+  key_MARIA_SHARE_intern_cond= (*reg_rwlock)(
+    "MARIA_SHARE::intern_cond", global);
+  key_MARIA_FILE_BITMAP_bitmap_cond= (*reg_rwlock)(
+    "MARIA_FILE_BITMAP::bitmap_cond", global);
+  key_MARIA_SORT_INFO_cond= (*reg_rwlock)(
+    "MARIA_SORT_INFO::cond", global);
+#endif
+}
+#endif
+

=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h	2008-10-10 20:34:55 +0000
+++ b/storage/maria/maria_def.h	2008-10-15 03:57:32 +0000
@@ -1180,3 +1180,38 @@ extern my_bool maria_flush_log_for_page_
                                              uchar *data_ptr);
 void maria_concurrent_inserts(MARIA_HA *info, my_bool concurrent_insert);
 extern PAGECACHE *maria_log_pagecache;
+
+#ifdef HAVE_PSI_INTERFACE
+extern PSI_mutex_key key_THR_LOCK_maria;
+extern PSI_mutex_key key_LOCK_trn_list;
+extern PSI_mutex_key key_TABLOCKMAN_pool_mutex;
+extern PSI_mutex_key key_LOCKED_TABLE_mutex;
+extern PSI_mutex_key key_translog_buffer_mutex;
+extern PSI_mutex_key key_translog_descriptor_sent_to_disk_lock;
+extern PSI_mutex_key key_translog_descriptor_file_header_lock;
+extern PSI_mutex_key key_translog_descriptor_unfinished_files_lock;
+extern PSI_mutex_key key_translog_descriptor_purger_lock;
+extern PSI_mutex_key key_translog_descriptor_log_flush_lock;
+extern PSI_mutex_key key_translog_descriptor_dirty_buffer_mask_lock;
+extern PSI_mutex_key key_PAGECACHE_cache_lock;
+extern PSI_mutex_key key_LOCK_checkpoint;
+extern PSI_rwlock_key key_translog_descriptor_open_files_lock;
+extern PSI_cond_key key_COND_checkpoint;
+extern PSI_cond_key key_translog_buffer_waiting_filling_buffer;
+extern PSI_cond_key key_translog_descriptor_log_flush_cond;
+#ifdef THREAD
+extern PSI_mutex_key key_MARIA_SHARE_intern_lock;
+extern PSI_mutex_key key_MARIA_FILE_BITMAP_bitmap_lock;
+extern PSI_mutex_key key_MARIA_SORT_INFO_mutex;
+extern PSI_rwlock_key key_MARIA_KEYDEF_root_lock;
+extern PSI_rwlock_key key_MARIA_SHARE_mmap_lock;
+extern PSI_cond_key key_MARIA_SHARE_intern_cond;
+extern PSI_cond_key key_MARIA_FILE_BITMAP_bitmap_cond;
+extern PSI_cond_key key_MARIA_SORT_INFO_cond;
+#endif
+
+C_MODE_START
+void init_maria_psi_keys();
+C_MODE_END
+#endif
+

=== modified file 'storage/maria/tablockman.c'
--- a/storage/maria/tablockman.c	2008-10-10 20:34:55 +0000
+++ b/storage/maria/tablockman.c	2008-10-15 03:57:32 +0000
@@ -18,6 +18,7 @@
 #include <my_base.h>
 #include <hash.h>
 #include "tablockman.h"
+#include "maria_def.h"
 
 /*
   Lock Manager for Table Locks
@@ -606,7 +607,7 @@ void tablockman_init(TABLOCKMAN *lm, loi
   lm->pool= 0;
   lm->loid_to_tlo= func;
   lm->lock_timeout= timeout;
-  pthread_mutex_init(& lm->pool_mutex, MY_MUTEX_INIT_FAST);
+  MYSQL_MUTEX_INIT(& lm->pool_mutex, key_TABLOCKMAN_pool_mutex, MY_MUTEX_INIT_FAST);
   my_getsystime(); /* ensure that my_getsystime() is initialized */
 }
 
@@ -631,7 +632,7 @@ void tablockman_destroy(TABLOCKMAN *lm)
 void tablockman_init_locked_table(LOCKED_TABLE *lt, int initial_hash_size)
 {
   bzero(lt, sizeof(*lt));
-  pthread_mutex_init(& lt->mutex, MY_MUTEX_INIT_FAST);
+  MYSQL_MUTEX_INIT(& lt->mutex, key_LOCKED_TABLE_mutex, MY_MUTEX_INIT_FAST);
   hash_init(& lt->latest_locks, & my_charset_bin, initial_hash_size,
             offsetof(TABLE_LOCK, loid),
             sizeof(((TABLE_LOCK*)0)->loid), 0, 0, 0);

=== modified file 'storage/maria/trnman.c'
--- a/storage/maria/trnman.c	2008-10-10 20:34:55 +0000
+++ b/storage/maria/trnman.c	2008-10-15 03:57:32 +0000
@@ -20,6 +20,7 @@
 #include "trnman.h"
 #include "ma_checkpoint.h"
 #include "ma_control_file.h"
+#include "maria_def.h"
 
 /*
   status variables:
@@ -168,7 +169,7 @@ int trnman_init(TrID initial_trid)
   lf_hash_init(&trid_to_committed_trn, sizeof(TRN*), LF_HASH_UNIQUE,
                0, 0, trn_get_hash_key, 0);
   DBUG_PRINT("info", ("pthread_mutex_init LOCK_trn_list"));
-  pthread_mutex_init(&LOCK_trn_list, MY_MUTEX_INIT_FAST);
+  MYSQL_MUTEX_INIT(&LOCK_trn_list, key_LOCK_trn_list, MY_MUTEX_INIT_FAST);
   my_atomic_rwlock_init(&LOCK_short_trid_to_trn);
   my_atomic_rwlock_init(&LOCK_pool);
 

Thread
bzr push into mysql-6.0-perf branch (marc.alff:2703 to 2704) Marc Alff15 Oct