List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:October 24 2011 1:19pm
Subject:bzr push into mysql-5.5-cluster branch (jonas.oreland:3616 to 3617)
View as plain text  
 3617 Jonas Oreland	2011-10-24 [merge]
      ndb - merge 71 to 72

    modified:
      storage/ndb/include/util/OutputStream.hpp
      storage/ndb/src/common/util/OutputStream.cpp
      storage/ndb/src/mgmapi/mgmapi.cpp
      storage/ndb/src/mgmsrv/Services.cpp
      storage/ndb/test/include/NdbMgmd.hpp
 3616 Jonas Oreland	2011-10-24
      ndb - further cmake (install) fixes
      - have_clusterj_inc - adopt to 5.5 install layout (?)
      - add shared lib version
      - install clusterj jars
      - move NDB_GET_CONFIG_VALUE into own file (used from several locations)

    added:
      storage/ndb/cmake/ndb_get_config_value.cmake
    modified:
      mysql-test/suite/ndb/include/have_clusterj.inc
      storage/ndb/CMakeLists.txt
      storage/ndb/VERSION
      storage/ndb/clusterj/CMakeLists.txt
      storage/ndb/clusterj/clusterj-api/CMakeLists.txt
      storage/ndb/clusterj/clusterj-jpatest/CMakeLists.txt
      storage/ndb/clusterj/clusterj-openjpa/CMakeLists.txt
      storage/ndb/clusterj/clusterj-test/CMakeLists.txt
      storage/ndb/include/CMakeLists.txt
      storage/ndb/src/CMakeLists.txt
=== modified file 'storage/ndb/include/util/OutputStream.hpp'
--- a/storage/ndb/include/util/OutputStream.hpp	2011-07-05 12:46:07 +0000
+++ b/storage/ndb/include/util/OutputStream.hpp	2011-10-24 13:14:28 +0000
@@ -33,6 +33,7 @@ public:
     ATTRIBUTE_FORMAT(printf, 2, 3) = 0;
   virtual int println(const char * fmt, ...)
     ATTRIBUTE_FORMAT(printf, 2, 3) = 0;
+  virtual int write(const void * buf, size_t len) = 0;
   virtual void flush() {};
   virtual void reset_timeout() {};
 };
@@ -48,6 +49,7 @@ public:
     ATTRIBUTE_FORMAT(printf, 2, 3);
   int println(const char * fmt, ...)
     ATTRIBUTE_FORMAT(printf, 2, 3);
+  int write(const void * buf, size_t len);
   void flush() { fflush(f); }
 };
 
@@ -67,6 +69,7 @@ public:
     ATTRIBUTE_FORMAT(printf, 2, 3);
   int println(const char * fmt, ...)
     ATTRIBUTE_FORMAT(printf, 2, 3);
+  int write(const void * buf, size_t len);
 };
 
 
@@ -82,6 +85,7 @@ public:
   int println(const char * fmt, ...)
     ATTRIBUTE_FORMAT(printf, 2, 3);
 
+  int write(const void * buf, size_t len);
   void flush();
 };
 
@@ -92,6 +96,7 @@ public:
   virtual ~NullOutputStream() {}
   int print(const char * /* unused */, ...) { return 1;}
   int println(const char * /* unused */, ...) { return 1;}
+  int write(const void * buf, size_t len) { return 1;}
 };
 
 #endif

=== modified file 'storage/ndb/src/common/util/OutputStream.cpp'
--- a/storage/ndb/src/common/util/OutputStream.cpp	2011-02-01 23:27:25 +0000
+++ b/storage/ndb/src/common/util/OutputStream.cpp	2011-10-24 07:44:52 +0000
@@ -43,6 +43,12 @@ FileOutputStream::println(const char * f
   return ret + fprintf(f, "\n");
 }
 
+int
+FileOutputStream::write(const void * buf, size_t len)
+{
+  return (int)fwrite(buf, len, 1, f);
+}
+
 SocketOutputStream::SocketOutputStream(NDB_SOCKET_TYPE socket,
 				       unsigned write_timeout_ms) :
   m_socket(socket),
@@ -97,6 +103,28 @@ SocketOutputStream::println(const char *
   return ret;
 }
 
+int
+SocketOutputStream::write(const void * buf, size_t len)
+{
+  if (timedout())
+    return -1;
+
+  int time = 0;
+  int ret = write_socket(m_socket, m_timeout_ms, &time,
+                         (const char*)buf, (int)len);
+  if (ret >= 0)
+  {
+    m_timeout_remain -= time;
+  }
+
+  if ((ret < 0 && errno == SOCKET_ETIMEDOUT) || m_timeout_remain <= 0)
+  {
+    m_timedout = true;
+    ret= -1;
+  }
+  return ret;
+}
+
 #include <UtilBuffer.hpp>
 #include <BaseString.hpp>
 
@@ -172,6 +200,12 @@ BufferedSockOutputStream::println(const
   return 0;
 }
 
+int
+BufferedSockOutputStream::write(const void * buf, size_t len)
+{
+  return m_buffer.append(buf, len);
+}
+
 void BufferedSockOutputStream::flush(){
   int elapsed = 0;
   if (write_socket(m_socket, m_timeout_ms, &elapsed,

=== modified file 'storage/ndb/src/mgmapi/mgmapi.cpp'
--- a/storage/ndb/src/mgmapi/mgmapi.cpp	2011-10-21 12:36:44 +0000
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp	2011-10-24 13:14:28 +0000
@@ -499,7 +499,10 @@ ndb_mgm_call(NdbMgmHandle handle,
   out.println("%s", "");
 
   if (cmd_bulk)
-    out.println(cmd_bulk);
+  {
+    out.write(cmd_bulk, strlen(cmd_bulk));
+    out.write("\n", 1);
+  }
 
   CHECK_TIMEDOUT_RET(handle, in, out, NULL);
 

=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp	2011-10-21 12:36:44 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp	2011-10-24 13:14:28 +0000
@@ -599,15 +599,17 @@ MgmApiSession::getConfig(Parser_t::Conte
   m_output->println("Content-Transfer-Encoding: base64");
   m_output->print("\n");
 
+  unsigned len = (unsigned)strlen(pack64.c_str());
   if(ERROR_INSERTED(3))
   {
     // Return only half the packed config
     BaseString half64 = pack64.substr(0, pack64.length());
-    m_output->println(half64.c_str());
+    m_output->write(half64.c_str(), (unsigned)strlen(half64.c_str()));
+    m_output->write("\n", 1);
     return;
   }
-  m_output->println(pack64.c_str());
-  m_output->print("\n");
+  m_output->write(pack64.c_str(), len);
+  m_output->write("\n\n", 2);
   return;
 }
 
@@ -1430,9 +1432,20 @@ Ndb_mgmd_event_service::log(int eventTyp
 
       int r;
       if (m_clients[i].m_parsable)
-        r= out.println(str.c_str());
+      {
+        unsigned len = str.length();
+        r= out.write(str.c_str(), len);
+      }
       else
-        r= out.println(pretty_text);
+      {
+        unsigned len = (unsigned)strlen(pretty_text);
+        r= out.write(pretty_text, len);
+      }
+
+      if (! (r < 0))
+      {
+        r = out.write("\n", 1);
+      }
 
       if (r<0)
       {

=== modified file 'storage/ndb/test/include/NdbMgmd.hpp'
--- a/storage/ndb/test/include/NdbMgmd.hpp	2011-10-19 12:20:58 +0000
+++ b/storage/ndb/test/include/NdbMgmd.hpp	2011-10-24 13:14:28 +0000
@@ -278,9 +278,16 @@ public:
     }
 
     // Send any bulk data
-    if (bulk && out.println("%s", bulk)){
-      error("call: print('<bulk>') failed at line %d", __LINE__);
-      return false;
+    if (bulk)
+    {
+      if (out.write(bulk, strlen(bulk)) >= 0)
+      {
+        if (out.write("\n", 1) < 0)
+        {
+          error("call: print('<bulk>') failed at line %d", __LINE__);
+          return false;
+        }
+      }
     }
 
     BaseString buf;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (jonas.oreland:3616 to 3617) Jonas Oreland25 Oct