List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:August 3 2009 1:03pm
Subject:bzr commit into mysql-5.1-telco-6.3 branch (jonas:3002)
View as plain text  
#At file:///home/jonas/src/telco-6.3/ based on revid:jonas@stripped

 3002 Jonas Oreland	2009-08-03 [merge]
      merge 62 to 63

    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/blocks/ndbcntr/NdbcntrMain.cpp
      storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
      storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
      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/blocks/ndbcntr/NdbcntrMain.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2009-05-27 12:11:46 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2009-08-03 13:03:32 +0000
@@ -351,6 +351,12 @@ parse_spec(Vector<ddentry> & dst,
     {
       group.size = parse_size(list[i].c_str() + keylen);
     }
+    else if (strlen(list[i].c_str()) == 0 && (i + 1) == list.size())
+    {
+      /**
+       * ignore stray ";"
+       */
+    }
     else
     {
       /**
@@ -410,7 +416,7 @@ Ndbcntr::execREAD_CONFIG_REQ(Signal* sig
       if (parse_spec(f_dd, lgspec, DictTabInfo::LogfileGroup))
       {
         BaseString::snprintf(buf, sizeof(buf),
-                             "Unable to parse InitalLogfileGroup: %s", lgspec);
+                             "Unable to parse InitialLogfileGroup: %s", lgspec);
         progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
       }
     }
@@ -420,9 +426,9 @@ Ndbcntr::execREAD_CONFIG_REQ(Signal* sig
     {
       if (f_dd.size() == 0)
       {
-        warningEvent("InitalTablespace specified, "
-                     "but InitalLogfileGroup is not!");
-        warningEvent("Ignoring InitalTablespace: %s",
+        warningEvent("InitialTablespace specified, "
+                     "but InitialLogfileGroup is not!");
+        warningEvent("Ignoring InitialTablespace: %s",
                      tsspec);
       }
       else
@@ -430,7 +436,7 @@ Ndbcntr::execREAD_CONFIG_REQ(Signal* sig
         if (parse_spec(f_dd, tsspec, DictTabInfo::Tablespace))
         {
           BaseString::snprintf(buf, sizeof(buf),
-                               "Unable to parse InitalTablespace: %s", tsspec);
+                               "Unable to parse InitialTablespace: %s", tsspec);
           progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
         }
       }

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp	2009-05-27 12:11:46 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp	2009-08-03 13:03:32 +0000
@@ -140,6 +140,19 @@ validate_path(BaseString & dst,
   return true;
 }
 
+const BaseString&
+Ndbfs::get_base_path(Uint32 no) const
+{
+  if (no < NDB_ARRAY_SIZE(m_base_path) &&
+      strlen(m_base_path[no].c_str()) > 0)
+  {
+    jam();
+    return m_base_path[no];
+  }
+  
+  return m_base_path[FsOpenReq::BP_FS];
+}
+
 void 
 Ndbfs::execREAD_CONFIG_REQ(Signal* signal)
 {
@@ -164,51 +177,51 @@ Ndbfs::execREAD_CONFIG_REQ(Signal* signa
   ndb_mgm_get_string_parameter(p, CFG_DB_DD_FILESYSTEM_PATH, &ddpath);
 
   {
-    const char * datapath = 0;
+    const char * datapath = ddpath;
     ndb_mgm_get_string_parameter(p, CFG_DB_DD_DATAFILE_PATH, &datapath);
-    if (datapath == 0)
-    {
-      if (ddpath)
-        datapath = ddpath;
-      else
-        datapath = m_ctx.m_config.fileSystemPath();
-    }
-
-    BaseString path;
-    add_path(path, datapath);
-    do_mkdir(path.c_str());
-    add_path(path, tmp.c_str());
-    do_mkdir(path.c_str());
-    if (!validate_path(m_base_path[FsOpenReq::BP_DD_DF], path.c_str()))
+    if (datapath)
     {
-      ERROR_SET(fatal, NDBD_EXIT_AFS_INVALIDPATH,
-                m_base_path[FsOpenReq::BP_DD_DF].c_str(),
-                "FileSystemPathDataFiles");
+      /**
+       * Only set BP_DD_DF if either FileSystemPathDataFiles or FileSystemPathDD
+       *   is set...otherwise get_base_path(FsOpenReq::BP_DD_DF) will
+       *   return BP_FS (see get_base_path)
+       */
+      BaseString path;
+      add_path(path, datapath);
+      do_mkdir(path.c_str());
+      add_path(path, tmp.c_str());
+      do_mkdir(path.c_str());
+      if (!validate_path(m_base_path[FsOpenReq::BP_DD_DF], path.c_str()))
+      {
+        ERROR_SET(fatal, NDBD_EXIT_AFS_INVALIDPATH,
+                  m_base_path[FsOpenReq::BP_DD_DF].c_str(),
+                  "FileSystemPathDataFiles");
+      }
     }
   }
 
   {
-    const char * undopath = 0;
+    const char * undopath = ddpath;
     ndb_mgm_get_string_parameter(p, CFG_DB_DD_UNDOFILE_PATH, &undopath);
-    if (undopath == 0)
+    if (undopath)
     {
-      if (ddpath)
-        undopath = ddpath;
-      else
-        undopath = m_ctx.m_config.fileSystemPath();
-    }
-
-    BaseString path;
-    add_path(path, undopath);
-    do_mkdir(path.c_str());
-    add_path(path, tmp.c_str());
-    do_mkdir(path.c_str());
-
-    if (!validate_path(m_base_path[FsOpenReq::BP_DD_UF], path.c_str()))
-    {
-      ERROR_SET(fatal, NDBD_EXIT_AFS_INVALIDPATH,
-                m_base_path[FsOpenReq::BP_DD_UF].c_str(),
-                "FileSystemPathUndoFiles");
+      /**
+       * Only set BP_DD_DF if either FileSystemPathUndoFiles or FileSystemPathDD
+       *   is set...otherwise get_base_path(FsOpenReq::BP_DD_UF) will
+       *   return BP_FS (see get_base_path)
+       */
+      BaseString path;
+      add_path(path, undopath);
+      do_mkdir(path.c_str());
+      add_path(path, tmp.c_str());
+      do_mkdir(path.c_str());
+      
+      if (!validate_path(m_base_path[FsOpenReq::BP_DD_UF], path.c_str()))
+      {
+        ERROR_SET(fatal, NDBD_EXIT_AFS_INVALIDPATH,
+                  m_base_path[FsOpenReq::BP_DD_UF].c_str(),
+                  "FileSystemPathUndoFiles");
+      }
     }
   }
 
@@ -326,17 +339,17 @@ Ndbfs::execFSOPENREQ(Signal* signal)
     // QOD, should be arg to FSOPEN
     if (refToMain(userRef) == TSMAN)
     {
-      file->theFileName.set(m_base_path[FsOpenReq::BP_DD_DF],
+      file->theFileName.set(get_base_path(FsOpenReq::BP_DD_DF),
                             ptr, g_sectionSegmentPool);
     }
     else if (refToMain(userRef) == LGMAN)
     {
-      file->theFileName.set(m_base_path[FsOpenReq::BP_DD_UF],
+      file->theFileName.set(get_base_path(FsOpenReq::BP_DD_UF),
                             ptr, g_sectionSegmentPool);
     }
     else
     {
-      file->theFileName.set(m_base_path[FsOpenReq::BP_FS],
+      file->theFileName.set(get_base_path(FsOpenReq::BP_FS),
                             ptr, g_sectionSegmentPool);
     }
     releaseSections(handle);
@@ -386,10 +399,13 @@ Ndbfs::execFSREMOVEREQ(Signal* signal)
   
   if (version == 6)
   {
-    if (m_base_path[FsOpenReq::BP_FS] == m_base_path[bp])
+    ndbrequire(bp < NDB_ARRAY_SIZE(m_base_path));
+    if (strlen(m_base_path[bp].c_str()) == 0)
+    {
       goto ignore;
+    }
   }
-
+  
   ndbrequire(forward(file, request));
   return;
 ignore:

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp	2009-08-03 12:19:42 +0000
@@ -95,6 +95,7 @@ private:
   void readWriteRequest(  int action, Signal * signal );
 
   static Uint32 translateErrno(int aErrno);
+  const BaseString& get_base_path(Uint32 no) const;
 };
 
 class VoidFs : public SimulatedBlock

=== modified file 'storage/ndb/src/kernel/main.cpp'
--- a/storage/ndb/src/kernel/main.cpp	2009-05-27 12:11:46 +0000
+++ b/storage/ndb/src/kernel/main.cpp	2009-08-03 13:03:32 +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/jonas@mysql.com-20090803130332-pesbastqnj76b1is.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (jonas:3002)Jonas Oreland3 Aug