List:Commits« Previous MessageNext Message »
From:sanja Date:April 21 2008 2:15pm
Subject:bk commit into maria tree (bell:1.2628) BUG#35040
View as plain text  
Below is the list of changes that have just been committed into a local
maria repository of bell.  When bell does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-04-21 17:14:58+03:00, bell@stripped +2 -0
  Problems of partially freed waiting quque fixed (BUG#35040)

  mysys/wqueue.c@stripped, 2008-04-21 17:14:55+03:00, bell@stripped +23 -20
    Problems of partially freed waiting quque fixed.

  storage/maria/unittest/ma_pagecache_rwconsist.c@stripped, 2008-04-21 17:14:55+03:00, bell@stripped +4 -4
    Explicitly assigned initial value for increasing readability.
    Dbug file flush after each line for better debugging.
    Fixed code style.

diff -Nrup a/mysys/wqueue.c b/mysys/wqueue.c
--- a/mysys/wqueue.c	2008-02-25 23:31:56 +02:00
+++ b/mysys/wqueue.c	2008-04-21 17:14:55 +03:00
@@ -140,55 +140,58 @@ void wqueue_release_queue(WQUEUE *wqueue
   @brief Removes all threads waiting for read or first one waiting for write.
 
   @param wqueue          pointer to the queue structure
-  @apram thread          pointer to the thread to be added to the queue
+  @param thread          pointer to the thread to be added to the queue
+
+  @note This function is applicable only to single linked lists.
 */
 
 void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue)
 {
   struct st_my_thread_var *last= wqueue->last_thread;
   struct st_my_thread_var *next= last->next;
-  struct st_my_thread_var **prev= &last->next;
   struct st_my_thread_var *thread;
-  struct st_my_thread_var *new_last= NULL;
+  struct st_my_thread_var *new_list= NULL;
   uint first_type= next->lock_type;
   if (first_type == MY_PTHREAD_LOCK_WRITE)
   {
     /* release first waiting for write lock */
-    thread= next;
-    pthread_cond_signal(&thread->suspend);
-    if (thread == last)
+    pthread_cond_signal(&next->suspend);
+#ifndef DBUG_OFF
+    next->prev= NULL; /* force segfault if used */
+#endif
+    if (next == last)
       wqueue->last_thread= NULL;
-    *prev= thread->next;
-    thread->next= NULL;
+    else
+      last->next= next->next;
+    next->next= NULL;
     return;
   }
   do
   {
     thread= next;
     next= thread->next;
+#ifndef DBUG_OFF
+    thread->prev= NULL; /* force segfault if used */
+#endif
     if (thread->lock_type == MY_PTHREAD_LOCK_WRITE)
     {
       /* skip waiting for write lock */
-      *prev= thread;
-      prev= &thread->next;
-      new_last= NULL;
+      if (new_list)
+      {
+        thread->next= new_list->next;
+        new_list= new_list->next= thread;
+      }
+      else
+        new_list= thread->next= thread;
     }
     else
     {
       /* release waiting for read lock */
       pthread_cond_signal(&thread->suspend);
-      new_last= thread->next;
       thread->next= NULL;
     }
   } while (thread != last);
-  if (new_last)
-  {
-    /* last was deleted */
-    if (new_last == last)
-      wqueue->last_thread= NULL; /* empty list */
-    else
-      wqueue->last_thread= new_last;
-  }
+  wqueue->last_thread= new_list;
 }
 
 
diff -Nrup a/storage/maria/unittest/ma_pagecache_rwconsist.c b/storage/maria/unittest/ma_pagecache_rwconsist.c
--- a/storage/maria/unittest/ma_pagecache_rwconsist.c	2008-03-04 18:07:52 +02:00
+++ b/storage/maria/unittest/ma_pagecache_rwconsist.c	2008-04-21 17:14:55 +03:00
@@ -37,7 +37,7 @@ static char *file1_name= (char*)"page_ca
 static PAGECACHE_FILE file1;
 static pthread_cond_t COND_thread_count;
 static pthread_mutex_t LOCK_thread_count;
-static uint thread_count;
+static uint thread_count= 0;
 static PAGECACHE pagecache;
 
 static uint number_of_readers= 5;
@@ -214,7 +214,7 @@ int main(int argc __attribute__((unused)
 #if defined(__WIN__)
   default_dbug_option= "d:t:i:O,\\test_pagecache_consist.trace";
 #else
-  default_dbug_option= "d:t:i:o,/tmp/test_pagecache_consist.trace";
+  default_dbug_option= "d:t:i:O,/tmp/test_pagecache_consist.trace";
 #endif
   if (argc > 1)
   {
@@ -335,8 +335,8 @@ int main(int argc __attribute__((unused)
   pthread_mutex_lock(&LOCK_thread_count);
   while (thread_count)
   {
-    if ((error= pthread_cond_wait(&COND_thread_count,&LOCK_thread_count)))
-      diag("COND_thread_count: %d from pthread_cond_wait\n",error);
+    if ((error= pthread_cond_wait(&COND_thread_count, &LOCK_thread_count)))
+      diag("COND_thread_count: %d from pthread_cond_wait\n", error);
   }
   pthread_mutex_unlock(&LOCK_thread_count);
   DBUG_PRINT("info", ("thread ended"));
Thread
bk commit into maria tree (bell:1.2628) BUG#35040sanja21 Apr
  • Re: bk commit into maria tree (bell:1.2628) BUG#35040Guilhem Bichot21 Apr