List:Commits« Previous MessageNext Message »
From:Marc Alff Date:November 20 2009 5:41pm
Subject:bzr commit into mysql-6.0-codebase branch (marc.alff:3720)
View as plain text  
#At file:///home/malff/BZR_TREE/mysql-6.0-codebase-merge/ based on revid:kostja@stripped

 3720 Marc Alff	2009-11-20 [merge]
      Merge to mysql-6.0-codebase

    modified:
      .bzr-mysql/default.conf
      CMakeLists.txt
      configure.in
      include/Makefile.am
      include/atomic/rwlock.h
      include/lf.h
      include/my_atomic.h
      include/my_pthread.h
      mysys/my_atomic.c
      mysys/my_getncpus.c
=== modified file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf	2009-11-12 03:21:14 +0000
+++ b/.bzr-mysql/default.conf	2009-11-20 17:41:35 +0000
@@ -1,4 +1,4 @@
 [MYSQL]
 post_commit_to = "commits@stripped"
 post_push_to = "commits@stripped"
-tree_name = "mysql-6.0-codebase-bugfixing"
+tree_name = "mysql-6.0-codebase"

=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	2009-11-05 08:44:22 +0000
+++ b/CMakeLists.txt	2009-11-18 04:34:55 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (C) 2006 MySQL AB, 2009 Sun Microsystems, Inc
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -314,10 +314,16 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/s
 SET (ENGINE_BUILD_TYPE "STATIC")
 FOREACH(DIR ${STATIC_ENGINE_DIRECTORIES})
   ADD_SUBDIRECTORY(${DIR})
+  IF(EXISTS ${DIR}/unittest)
+        ADD_SUBDIRECTORY(${DIR}/unittest)
+  ENDIF(EXISTS ${DIR}/unittest)
 ENDFOREACH(DIR ${STATIC_ENGINE_DIRECTORIES})
 
 SET (ENGINE_BUILD_TYPE "DYNAMIC")
 FOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
+  IF(EXISTS ${DIR}/unittest)
+        ADD_SUBDIRECTORY(${DIR}/unittest)
+  ENDIF(EXISTS ${DIR}/unittest)
   ADD_SUBDIRECTORY(${DIR})
 ENDFOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
 

=== modified file 'configure.in'
--- a/configure.in	2009-11-12 03:14:04 +0000
+++ b/configure.in	2009-11-18 03:02:54 +0000
@@ -1828,8 +1828,8 @@ then
 fi
 
 AC_ARG_WITH([atomic-ops],
-	    AS_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
-	    [Implement atomic operations using pthread rwlocks or atomic CPU
+            AS_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
+            [Implement atomic operations using pthread rwlocks or atomic CPU
              instructions for multi-processor or uniprocessor
              configuration. By default gcc built-in sync functions are used,
              if available and 'smp' configuration otherwise.]))
@@ -1873,23 +1873,23 @@ if test "x$mysql_cv_gcc_atomic_builtins"
 fi
 
 AC_CACHE_CHECK([whether the OS provides atomic_* functions like Solaris],
-               [mysql_cv_solaris_atomic], 
+               [mysql_cv_solaris_atomic],
   [AC_RUN_IFELSE(
      [AC_LANG_PROGRAM(
         [
         #include <atomic.h>
         ]
      [[
-	int foo = -10; int bar = 10;
-	if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
-		return -1;
-	bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
-	if (bar || foo != 10)
-		return -1;
-	bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
-	if (bar)
-		return -1;
-	return 0;
+        int foo = -10; int bar = 10;
+        if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
+          return -1;
+        bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
+        if (bar || foo != 10)
+          return -1;
+        bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
+        if (bar)
+          return -1;
+        return 0;
      ]]
      )],
    [mysql_cv_solaris_atomic=yes],

=== modified file 'include/Makefile.am'
--- a/include/Makefile.am	2009-11-05 08:44:22 +0000
+++ b/include/Makefile.am	2009-11-18 03:02:54 +0000
@@ -40,9 +40,9 @@ noinst_HEADERS =	config-win.h config-net
 			my_handler.h my_time.h service_versions.h \
 			my_vle.h my_user.h my_atomic.h atomic/nolock.h \
 			atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
-                        atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
-                        atomic/solaris.h \
-                        wqueue.h waiting_threads.h
+			atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
+			atomic/solaris.h \
+			wqueue.h waiting_threads.h
 EXTRA_DIST =        mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base 
 
 # Remove built files and the symlinked directories

=== modified file 'include/atomic/rwlock.h'
--- a/include/atomic/rwlock.h	2009-10-26 14:02:26 +0000
+++ b/include/atomic/rwlock.h	2009-11-18 01:25:50 +0000
@@ -1,7 +1,7 @@
 #ifndef ATOMIC_RWLOCK_INCLUDED
 #define ATOMIC_RWLOCK_INCLUDED
 
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (C) 2006 MySQL AB, 2009 Sun Microsystems, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -16,7 +16,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-typedef struct {pthread_mutex_t rw;} my_atomic_rwlock_t;
 #define MY_ATOMIC_MODE_RWLOCKS 1
 
 #ifdef MY_ATOMIC_MODE_DUMMY
@@ -27,6 +26,9 @@ typedef struct {pthread_mutex_t rw;} my_
   implementations (another way is to run a UP build on an SMP box).
 */
 #warning MY_ATOMIC_MODE_DUMMY and MY_ATOMIC_MODE_RWLOCKS are incompatible
+
+typedef char my_atomic_rwlock_t;
+
 #define my_atomic_rwlock_destroy(name)
 #define my_atomic_rwlock_init(name)
 #define my_atomic_rwlock_rdlock(name)
@@ -34,7 +36,12 @@ typedef struct {pthread_mutex_t rw;} my_
 #define my_atomic_rwlock_rdunlock(name)
 #define my_atomic_rwlock_wrunlock(name)
 #define MY_ATOMIC_MODE "dummy (non-atomic)"
-#else
+#else /* not MY_ATOMIC_MODE_DUMMY */
+
+typedef struct {pthread_mutex_t rw;} my_atomic_rwlock_t;
+
+#ifndef SAFE_MUTEX
+
 /*
   we're using read-write lock macros but map them to mutex locks, and they're
   faster. Still, having semantically rich API we can change the
@@ -46,6 +53,38 @@ typedef struct {pthread_mutex_t rw;} my_
 #define my_atomic_rwlock_wrlock(name)      pthread_mutex_lock(& (name)->rw)
 #define my_atomic_rwlock_rdunlock(name)    pthread_mutex_unlock(& (name)->rw)
 #define my_atomic_rwlock_wrunlock(name)    pthread_mutex_unlock(& (name)->rw)
+
+#else /* SAFE_MUTEX */
+
+/*
+  SAFE_MUTEX pollutes the compiling name space with macros
+  that alter pthread_mutex_t, pthread_mutex_init, etc.
+  Atomic operations should never use the safe mutex wrappers.
+  Unfortunately, there is no way to have both:
+  - safe mutex macros expanding pthread_mutex_lock to safe_mutex_lock
+  - my_atomic macros expanding to unmodified pthread_mutex_lock
+  inlined in the same compilation unit.
+  So, in case of SAFE_MUTEX, a function call is required.
+  Given that SAFE_MUTEX is a debugging facility,
+  this extra function call is not a performance concern for
+  production builds.
+*/
+C_MODE_START
+extern void plain_pthread_mutex_init(safe_mutex_t *);
+extern void plain_pthread_mutex_destroy(safe_mutex_t *);
+extern void plain_pthread_mutex_lock(safe_mutex_t *);
+extern void plain_pthread_mutex_unlock(safe_mutex_t *);
+C_MODE_END
+
+#define my_atomic_rwlock_destroy(name)     plain_pthread_mutex_destroy(&(name)->rw)
+#define my_atomic_rwlock_init(name)        plain_pthread_mutex_init(&(name)->rw)
+#define my_atomic_rwlock_rdlock(name)      plain_pthread_mutex_lock(&(name)->rw)
+#define my_atomic_rwlock_wrlock(name)      plain_pthread_mutex_lock(&(name)->rw)
+#define my_atomic_rwlock_rdunlock(name)    plain_pthread_mutex_unlock(&(name)->rw)
+#define my_atomic_rwlock_wrunlock(name)    plain_pthread_mutex_unlock(&(name)->rw)
+
+#endif /* SAFE_MUTEX */
+
 #define MY_ATOMIC_MODE "mutex"
 #ifndef MY_ATOMIC_MODE_RWLOCKS
 #define MY_ATOMIC_MODE_RWLOCKS 1

=== modified file 'include/lf.h'
--- a/include/lf.h	2009-04-30 21:09:04 +0000
+++ b/include/lf.h	2009-11-18 03:02:54 +0000
@@ -18,6 +18,8 @@
 
 #include <my_atomic.h>
 
+C_MODE_START
+
 /*
   Helpers to define both func() and _func(), where
   func() is a _func() protected by my_atomic_rwlock_wrlock()
@@ -209,11 +211,15 @@ lock_wrap(lf_alloc_new, void *,
           (pins),
           &pins->pinbox->pinarray.lock)
 
+C_MODE_END
+
 /*
   extendible hash, lf_hash.c
 */
 #include <hash.h>
 
+C_MODE_START
+
 #define LF_HASH_UNIQUE 1
 
 /* lf_hash overhead per element (that is, sizeof(LF_SLIST) */
@@ -256,5 +262,7 @@ int lf_hash_delete(LF_HASH *hash, LF_PIN
 #undef nolock_wrap_void
 #undef nolock_wrap
 
+C_MODE_END
+
 #endif
 

=== modified file 'include/my_atomic.h'
--- a/include/my_atomic.h	2009-10-26 14:02:26 +0000
+++ b/include/my_atomic.h	2009-11-18 01:25:50 +0000
@@ -49,7 +49,7 @@
   On architectures where these operations are really atomic, rwlocks will
   be optimized away.
   8- and 16-bit atomics aren't implemented for windows (see generic-msvc.h),
-  but can be added, if necessary. 
+  but can be added, if necessary.
 */
 
 #ifndef my_atomic_rwlock_init

=== modified file 'include/my_pthread.h'
--- a/include/my_pthread.h	2009-11-05 08:44:22 +0000
+++ b/include/my_pthread.h	2009-11-18 03:02:54 +0000
@@ -149,7 +149,7 @@ int pthread_join(pthread_t thread, void
 #define pthread_detach_this_thread()
 #define pthread_condattr_init(A)
 #define pthread_condattr_destroy(A)
-#define pthread_yield() SwitchToThread() 
+#define pthread_yield() SwitchToThread()
 
 
 #else /* Normal threads */

=== modified file 'mysys/my_atomic.c'
--- a/mysys/my_atomic.c	2008-07-22 14:16:22 +0000
+++ b/mysys/my_atomic.c	2009-11-18 01:25:50 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (C) 2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -43,3 +43,32 @@ int my_atomic_initialize()
 #endif
 }
 
+#ifdef SAFE_MUTEX
+#undef pthread_mutex_init
+#undef pthread_mutex_destroy
+#undef pthread_mutex_lock
+#undef pthread_mutex_unlock
+
+void plain_pthread_mutex_init(safe_mutex_t *m)
+{
+  pthread_mutex_init(& m->mutex, NULL);
+}
+
+void plain_pthread_mutex_destroy(safe_mutex_t *m)
+{
+  pthread_mutex_destroy(& m->mutex);
+}
+
+void plain_pthread_mutex_lock(safe_mutex_t *m)
+{
+  pthread_mutex_lock(& m->mutex);
+}
+
+void plain_pthread_mutex_unlock(safe_mutex_t *m)
+{
+  pthread_mutex_unlock(& m->mutex);
+}
+
+#endif
+
+

=== modified file 'mysys/my_getncpus.c'
--- a/mysys/my_getncpus.c	2008-07-23 08:52:08 +0000
+++ b/mysys/my_getncpus.c	2009-11-18 01:25:50 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (C) 2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -31,13 +31,13 @@ int my_getncpus()
 #elif defined(__WIN__)
     SYSTEM_INFO sysinfo;
 
-	/*
-	* We are not calling GetNativeSystemInfo here because (1) we
-	* don't believe that they return different values for number
-	* of processors and (2) if WOW64 limits processors for Win32
-	* then we don't want to try to override that.
-	*/
-	GetSystemInfo(&sysinfo);
+    /*
+    * We are not calling GetNativeSystemInfo here because (1) we
+    * don't believe that they return different values for number
+    * of processors and (2) if WOW64 limits processors for Win32
+    * then we don't want to try to override that.
+    */
+    GetSystemInfo(&sysinfo);
 
     ncpus= sysinfo.dwNumberOfProcessors;
 #else


Attachment: [text/bzr-bundle] bzr/marc.alff@sun.com-20091120174135-4rw2dz7tr8hxk4s8.bundle
Thread
bzr commit into mysql-6.0-codebase branch (marc.alff:3720) Marc Alff20 Nov