List:Commits« Previous MessageNext Message »
From:guilhem Date:September 13 2006 5:59pm
Subject:bk commit into 5.1 tree (guilhem:1.2323) BUG#22320
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of guilhem. When guilhem 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, 2006-09-13 19:58:57+02:00, guilhem@stripped +1 -0
  fixes for the my_atomic-t unit test:
  - compiler warning
  - detection of pthread_create failure (you will see this message
  only if you run with "make test-verbose" in unittest; otherwise
  unit.pl masks all messages from the test but "ok" ones.
  - the test fails randomly on some machines (I filed it as BUG#22320),
  on one host it looks like a crash at exit() which a sleep(2) makes
  disappear. So I add the sleep(2), which can be removed
  when BUG#22320 is fixed. 

  unittest/mysys/my_atomic-t.c@stripped, 2006-09-13 19:58:55+02:00, guilhem@stripped +17 -3
    - fix for compiler warning on 64-bit "cast from pointer to integer of
    different size". Casting to long and then to int. We'll use intptr
    instead later.
    - detect if pthread_create fails.
    - sleep(2) until BUG#22320 is fixed

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	guilhem
# Host:	gbichot3.local
# Root:	/home/mysql_src/mysql-5.1-rpl-clean

--- 1.5/unittest/mysys/my_atomic-t.c	2006-09-13 19:59:04 +02:00
+++ 1.6/unittest/mysys/my_atomic-t.c	2006-09-13 19:59:04 +02:00
@@ -32,7 +32,7 @@ pthread_handler_t test_atomic_add_handle
 {
   int    m=*(int *)arg;
   int32 x;
-  for (x=((int)(&m)); m ; m--)
+  for (x=((int)((long)(&m))); m ; m--)
   {
     x=x*m+0x87654321;
     my_atomic_rwlock_wrlock(&rwl);
@@ -104,7 +104,7 @@ pthread_handler_t test_atomic_cas_handle
 {
   int    m=*(int *)arg, ok;
   int32 x,y;
-  for (x=((int)(&m)); m ; m--)
+  for (x=((int)((long)(&m))); m ; m--)
   {
     my_atomic_rwlock_wrlock(&rwl);
     y=my_atomic_load32(&a32);
@@ -140,13 +140,21 @@ void test_atomic(const char *test, pthre
 
   diag("Testing %s with %d threads, %d iterations... ", test, n, m);
   for (N=n ; n ; n--)
-    pthread_create(&t, &thr_attr, handler, &m);
+  {
+    if (pthread_create(&t, &thr_attr, handler, &m) != 0)
+    {
+      diag("Could not create thread");
+      a32= 1;
+      goto err;
+    }
+  }
 
   pthread_mutex_lock(&mutex);
   while (N)
     pthread_cond_wait(&cond, &mutex);
   pthread_mutex_unlock(&mutex);
   now=my_getsystime()-now;
+err:
   ok(a32 == 0, "tested %s in %g secs", test, ((double)now)/1e7);
 }
 
@@ -169,6 +177,12 @@ int main()
   test_atomic("my_atomic_add32", test_atomic_add_handler, 100,10000);
   test_atomic("my_atomic_swap32", test_atomic_swap_handler, 100,10000);
   test_atomic("my_atomic_cas32", test_atomic_cas_handler, 100,10000);
+
+  /*
+    workaround until we know why it crashes randomly on some machine
+    (BUG#22320).
+  */
+  sleep(2);
 
   pthread_mutex_destroy(&mutex);
   pthread_cond_destroy(&cond);
Thread
bk commit into 5.1 tree (guilhem:1.2323) BUG#22320guilhem13 Sep