List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:July 15 2009 6:14pm
Subject:bzr commit into mysql-5.1-telco-6.2 branch (magnus.blaudd:2956)
Bug#46183
View as plain text  
#At file:///home/msvensson/mysql/6.2/ based on revid:magnus.blaudd@stripped4tmehxboav

 2956 Magnus Blåudd	2009-07-15
      BUG#46183 Cluster query performance regression on Solaris
       - make it possible to control which processes use monotonic timers
         by adding a global variable read by 'ndb_init' that forces it
         to initialize timers and conditions with monotonic timers
         if that is available
       - always set the global variable except on Solaris since it's
         better to use monotonic if possible
       - always set teh global variable in ndbd since it relies on the clock
         to be monotonic in it's scheduler loop

    modified:
      storage/ndb/src/common/portlib/NdbCondition.c
      storage/ndb/src/common/portlib/NdbTick.c
      storage/ndb/src/common/util/ndb_init.cpp
      storage/ndb/src/kernel/main.cpp
=== modified file 'storage/ndb/src/common/portlib/NdbCondition.c'
--- a/storage/ndb/src/common/portlib/NdbCondition.c	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/common/portlib/NdbCondition.c	2009-07-15 18:14:13 +0000
@@ -30,11 +30,15 @@ struct NdbCondition
 };
 
 #ifdef HAVE_CLOCK_GETTIME
+#ifdef CLOCK_MONOTONIC
+static int clock_id = CLOCK_MONOTONIC;
+#else
 static int clock_id = CLOCK_REALTIME;
 #endif
+#endif
 
 void
-NdbCondition_Init()
+NdbCondition_Init(int need_monotonic)
 {
 #if defined HAVE_CLOCK_GETTIME && defined HAVE_PTHREAD_CONDATTR_SETCLOCK && \
     defined CLOCK_MONOTONIC
@@ -42,6 +46,10 @@ NdbCondition_Init()
   int res, init = 0;
   pthread_cond_t tmp;
   pthread_condattr_t attr;
+
+  if (!need_monotonic)
+    return;
+
   if ((res = pthread_condattr_init(&attr)) != 0)
     goto nogo;
 

=== modified file 'storage/ndb/src/common/portlib/NdbTick.c'
--- a/storage/ndb/src/common/portlib/NdbTick.c	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/common/portlib/NdbTick.c	2009-07-15 18:14:13 +0000
@@ -34,9 +34,13 @@ static clockid_t NdbTick_clk_id = CLOCK_
 static clockid_t NdbTick_clk_id = CLOCK_REALTIME;
 #endif
 
-void NdbTick_Init()
+void NdbTick_Init(int need_monotonic)
 {
   struct timespec tick_time;
+
+  if (!need_monotonic)
+    NdbTick_clk_id = CLOCK_REALTIME;
+
   if (clock_gettime(NdbTick_clk_id, &tick_time) == 0)
     return;
 #ifdef CLOCK_MONOTONIC

=== modified file 'storage/ndb/src/common/util/ndb_init.cpp'
--- a/storage/ndb/src/common/util/ndb_init.cpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/common/util/ndb_init.cpp	2009-07-15 18:14:13 +0000
@@ -27,10 +27,14 @@ NdbMutex *g_ndb_connection_mutex = NULL;
 extern class EventLogger * create_event_logger();
 extern void destroy_event_logger(class EventLogger ** g_eventLogger);
 
+// Turn on monotonic timers and conditions by setting
+// this flag before calling ndb_init 
+int g_ndb_init_need_monotonic = 0;
+
 static int ndb_init_called = 0;
 
-extern "C" void NdbCondition_Init();
-extern "C" void NdbTick_Init();
+extern "C" void NdbCondition_Init(int need_monotonic);
+extern "C" void NdbTick_Init(int need_monotonic);
 
 extern "C"
 {
@@ -50,8 +54,12 @@ ndb_init_internal()
       exit(1);
     }
   }
-  NdbTick_Init();
-  NdbCondition_Init();
+  /* Always turn on monotonic unless on Solaris */  
+#ifndef __sun
+  g_ndb_init_need_monotonic = 1;
+#endif
+  NdbTick_Init(g_ndb_init_need_monotonic);
+  NdbCondition_Init(g_ndb_init_need_monotonic);
 }
 
 int

=== modified file 'storage/ndb/src/kernel/main.cpp'
--- a/storage/ndb/src/kernel/main.cpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/main.cpp	2009-07-15 18:14:13 +0000
@@ -229,8 +229,11 @@ do_next:
   return 0;
 }
 
+extern int g_ndb_init_need_monotonic;
+
 int main(int argc, char** argv)
 {
+  g_ndb_init_need_monotonic = 1;
   NDB_INIT(argv[0]);
   // Print to stdout/console
   g_eventLogger->createConsoleHandler();

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20090715181413-qu5byazxv2grzmo3.bundle
Thread
bzr commit into mysql-5.1-telco-6.2 branch (magnus.blaudd:2956)Bug#46183Magnus Blåudd15 Jul