List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:February 20 2012 9:18pm
Subject:bzr push into mysql-5.5-cluster-7.2 branch (jonas.oreland:3820 to 3821)
View as plain text  
 3821 Jonas Oreland	2012-02-20 [merge]
      ndb - merge 71 to 72

    modified:
      storage/ndb/include/util/BaseString.hpp
      storage/ndb/src/common/util/BaseString.cpp
      storage/ndb/test/run-test/command.cpp
 3820 Jonas Oreland	2012-02-20
      ndb - fix upgrade problem with change of MAX_NDBMT_LQH_WORKERS

    modified:
      storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
=== modified file 'storage/ndb/include/util/BaseString.hpp'
--- a/storage/ndb/include/util/BaseString.hpp	2011-06-30 15:59:25 +0000
+++ b/storage/ndb/include/util/BaseString.hpp	2012-02-20 21:01:57 +0000
@@ -133,9 +133,19 @@ public:
    * Returns the index of the first occurance of the character c.
    *
    * @params c character to look for
+   * @params pos position to start searching from
    * @returns index of character, of -1 if no character found
    */
-  ssize_t indexOf(char c) const;
+  ssize_t indexOf(char c, size_t pos = 0) const;
+
+  /**
+   * Returns the index of the first occurance of the string needle
+   *
+   * @params needle string to search for
+   * @params pos position to start searching from
+   * @returns index of character, of -1 if no character found
+   */
+  ssize_t indexOf(const char * needle, size_t pos = 0) const;
 
   /**
    * Returns the index of the last occurance of the character c.

=== modified file 'storage/ndb/src/common/util/BaseString.cpp'
--- a/storage/ndb/src/common/util/BaseString.cpp	2011-10-21 12:36:44 +0000
+++ b/storage/ndb/src/common/util/BaseString.cpp	2012-02-20 21:15:00 +0000
@@ -297,9 +297,24 @@ BaseString::split(Vector<BaseString> &v,
 }
 
 ssize_t
-BaseString::indexOf(char c) const {
-    char *p;
-    p = strchr(m_chr, c);
+BaseString::indexOf(char c, size_t pos) const {
+
+  if (pos >= m_len)
+    return -1;
+
+    char *p = strchr(m_chr + pos, c);
+    if(p == NULL)
+	return -1;
+    return (ssize_t)(p-m_chr);
+}
+
+ssize_t
+BaseString::indexOf(const char * needle, size_t pos) const {
+
+  if (pos >= m_len)
+    return -1;
+
+    char *p = strstr(m_chr + pos, needle);
     if(p == NULL)
 	return -1;
     return (ssize_t)(p-m_chr);

=== modified file 'storage/ndb/test/run-test/command.cpp'
--- a/storage/ndb/test/run-test/command.cpp	2012-02-20 09:14:06 +0000
+++ b/storage/ndb/test/run-test/command.cpp	2012-02-20 21:15:00 +0000
@@ -102,6 +102,24 @@ set_env_var(const BaseString& existing,
   return newEnv;
 }
 
+static
+char *
+dirname(const char * path)
+{
+  char * s = strdup(path);
+  size_t len = strlen(s);
+  for (size_t i = 1; i<len; i++)
+  {
+    if (s[len - i] == '/')
+    {
+      s[len - i] = 0;
+      return s;
+    }
+  }
+  free(s);
+  return 0;
+}
+
 
 Vector<atrt_process> g_saved_procs;
 
@@ -163,7 +181,7 @@ do_change_version(atrt_config& config, S
                                   BaseString(new_prefix));
   proc.m_proc.m_env.assign(newEnv);
 
-  ssize_t pos = proc.m_proc.m_path.lastIndexOf('/');
+  ssize_t pos = proc.m_proc.m_path.lastIndexOf('/') + 1;
   BaseString exename(proc.m_proc.m_path.substr(pos));
   char * exe = find_bin_path(new_prefix, exename.c_str());
   proc.m_proc.m_path = exe;
@@ -178,6 +196,33 @@ do_change_version(atrt_config& config, S
     proc.m_proc.m_args.append(process_args);
   }
 
+  {
+    /**
+     * In 5.5...binaries aren't compiled with rpath
+     * So we need an explicit LD_LIBRARY_PATH
+     * So when upgrading..we need to change LD_LIBRARY_PATH
+     * So I hate 5.5...
+     */
+    ssize_t p0 = proc.m_proc.m_env.indexOf(" LD_LIBRARY_PATH=");
+    ssize_t p1 = proc.m_proc.m_env.indexOf(' ', p0 + 1);
+
+    BaseString part0 = proc.m_proc.m_env.substr(0, p0);
+    BaseString part1 = proc.m_proc.m_env.substr(p1);
+
+    proc.m_proc.m_env.assfmt("%s%s",
+                             part0.c_str(),
+                             part1.c_str());
+
+    BaseString lib(g_libmysqlclient_so_path);
+    ssize_t pos = lib.lastIndexOf('/') + 1;
+    BaseString libname(lib.substr(pos));
+    char * exe = find_bin_path(new_prefix, libname.c_str());
+    char * dir = dirname(exe);
+    proc.m_proc.m_env.appfmt(" LD_LIBRARY_PATH=%s", dir);
+    free(exe);
+    free(dir);
+  }
+
   ndbout << proc << endl;
 
   g_logger.info("starting process...");

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster-7.2 branch (jonas.oreland:3820 to 3821) Jonas Oreland21 Feb