MySQL Lists are EOL. Please join:

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

 2959 Jonas Oreland	2009-08-03
      ndb - bug#46243
        Fix so that FileSystmPath[DD/DataFiles/UndoFiles] is cleared
        even if they have identical value as FileSystemPath

    modified:
      storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
      storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp	2009-08-03 12:19:42 +0000
@@ -138,6 +138,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)
 {
@@ -162,51 +175,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");
+      }
     }
   }
 
@@ -313,17 +326,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);
     }
 
@@ -374,10 +387,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


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20090803121942-7mw80cjg2kdr02j0.bundle
Thread
bzr commit into mysql-5.1-telco-6.2 branch (jonas:2959) Bug#46243Jonas Oreland3 Aug