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-09 15:20:58+03:00, bell@stripped +2 -0
Problems of partially freed waiting quque fixed (BUG#35040)
mysys/wqueue.c@stripped, 2008-04-09 15:20:55+03:00, bell@stripped +14 -15
Problems of partially freed waiting quque fixed.
storage/maria/unittest/ma_pagecache_rwconsist.c@stripped, 2008-04-09 15:20:55+03:00,
bell@stripped +5 -5
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-09 15:20:55 +03:00
@@ -147,9 +147,8 @@ void wqueue_release_one_locktype_from_qu
{
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)
{
@@ -157,8 +156,12 @@ void wqueue_release_one_locktype_from_qu
thread= next;
pthread_cond_signal(&thread->suspend);
if (thread == last)
+ {
+ DBUG_ASSERT(thread->next == thread);
wqueue->last_thread= NULL;
- *prev= thread->next;
+ }
+ else
+ last->next= thread->next;
thread->next= NULL;
return;
}
@@ -169,26 +172,22 @@ void wqueue_release_one_locktype_from_qu
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-09 15:20: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;
@@ -212,9 +212,9 @@ int main(int argc __attribute__((unused)
#ifndef DBUG_OFF
#if defined(__WIN__)
- default_dbug_option= "d:t:i:O,\\test_pagecache_consist.trace";
+ default_dbug_option= "d:f: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"));