List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:January 14 2009 2:13pm
Subject:bzr push into mysql-5.1 branch (msvensson:2789 to 2790)
View as plain text  
 2790 Magnus Svensson	2009-01-14 [merge]
      Merge
modified:
  storage/ndb/src/mgmapi/ndb_logevent.cpp
  storage/ndb/test/ndbapi/testMgm.cpp
  storage/ndb/test/tools/log_listner.cpp

 2789 Jonas Oreland	2009-01-13
      ndb - bug#42084 - dont limit TUP scans to 11, introduce different queue for TUP scans, so that it can be handled correctly wrt ACC scans
modified:
  storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp

=== modified file 'storage/ndb/src/mgmapi/ndb_logevent.cpp'
--- a/storage/ndb/src/mgmapi/ndb_logevent.cpp	2008-01-24 11:21:39 +0000
+++ b/storage/ndb/src/mgmapi/ndb_logevent.cpp	2009-01-14 10:47:05 +0000
@@ -19,8 +19,8 @@
 
 #include <NdbOut.hpp>
 #include <Properties.hpp>
-#include <socket_io.h>
 #include <InputStream.hpp>
+#include <NdbTick.h>
 
 #include <debugger/EventLogger.hpp>
 #include <kernel/NodeBitmask.hpp>
@@ -442,11 +442,15 @@ int ndb_logevent_get_next(const NdbLogEv
 
   SocketInputStream in(h->socket, timeout_in_milliseconds);
 
-  Properties p;
+  /*
+    Read log event header until header received
+    or timeout expired. The MGM server will continusly
+    send <PING>'s that should be ignored.
+  */
   char buf[256];
-
-  /* header */
-  while (1) {
+  NDB_TICKS start = NdbTick_CurrentMillisecond();
+  while(1)
+  {
     if (in.gets(buf,sizeof(buf)) == 0)
     {
       h->m_error= NDB_LEH_READ_ERROR;
@@ -466,9 +470,14 @@ int ndb_logevent_get_next(const NdbLogEv
 
     if(in.timedout())
         return 0;
-  }
 
-  /* read name-value pairs into properties object */
+    if ((NdbTick_CurrentMillisecond() - start) > timeout_in_milliseconds)
+      return 0;
+
+  };
+
+  /* Read name-value pairs until empty new line */
+  Properties p;
   while (1)
   {
     if (in.gets(buf,sizeof(buf)) == 0)

=== modified file 'storage/ndb/test/ndbapi/testMgm.cpp'
--- a/storage/ndb/test/ndbapi/testMgm.cpp	2007-06-13 12:54:00 +0000
+++ b/storage/ndb/test/ndbapi/testMgm.cpp	2009-01-14 10:47:05 +0000
@@ -787,6 +787,56 @@ done:
   return result;
 }
 
+// Enabled in 6.4
+#if NDB_VERSION_D > 60400
+int runTestBug40922(NDBT_Context* ctx, NDBT_Step* step)
+{
+  NdbMgmd mgmd;
+
+  if (!mgmd.connect())
+    return NDBT_FAILED;
+
+  int filter[] = {
+    15, NDB_MGM_EVENT_CATEGORY_BACKUP,
+    1, NDB_MGM_EVENT_CATEGORY_STARTUP,
+    0
+  };
+  NdbLogEventHandle le_handle =
+    ndb_mgm_create_logevent_handle(mgmd.handle(), filter);
+  if (!le_handle)
+    return NDBT_FAILED;
+
+  g_info << "Calling ndb_log_event_get_next" << endl;
+
+  struct ndb_logevent le_event;
+  int r = ndb_logevent_get_next(le_handle,
+                                &le_event,
+                                2000);
+  g_info << "ndb_log_event_get_next returned " << r << endl;
+
+  int result = NDBT_FAILED;
+  if (r == 0)
+  {
+    // Got timeout
+    g_info << "ndb_logevent_get_next returned timeout" << endl;
+    result = NDBT_OK;
+  }
+  else
+  {
+    if(r>0)
+      g_err << "ERROR: Receieved unexpected event: "
+            << le_event.type << endl;
+    if(r<0)
+      g_err << "ERROR: ndb_logevent_get_next returned error: "
+            << r << endl;
+  }
+
+  ndb_mgm_destroy_logevent_handle(&le_handle);
+
+  return result;
+}
+#endif
+
 NDBT_TESTSUITE(testMgm);
 TESTCASE("SingleUserMode", 
 	 "Test single user mode"){
@@ -828,6 +878,14 @@ TESTCASE("ApiMgmStructEventTimeout",
   INITIALIZER(runTestMgmApiStructEventTimeout);
 
 }
+// Enabled in 6.4
+#if 0
+TESTCASE("Bug40922",
+	 "Make sure that ndb_logevent_get_next returns when "
+         "called with a timeout"){
+  INITIALIZER(runTestBug40922);
+}
+#endif
 NDBT_TESTSUITE_END(testMgm);
 
 int main(int argc, const char** argv){

=== modified file 'storage/ndb/test/tools/log_listner.cpp'
--- a/storage/ndb/test/tools/log_listner.cpp	2007-04-10 08:27:02 +0000
+++ b/storage/ndb/test/tools/log_listner.cpp	2009-01-14 13:33:03 +0000
@@ -7,15 +7,11 @@ NDB_STD_OPTS_VARS;
 
 static struct my_option my_long_options[] =
 {
-  NDB_STD_OPTS("ndb_logevent_listen"),
+  NDB_STD_OPTS("eventlog"),
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 static void usage()
 {
-  char desc[] = 
-    "tabname\n"\
-    "This program list all properties of table(s) in NDB Cluster.\n"\
-    "  ex: desc T1 T2 T4\n";
   ndb_std_print_version();
   my_print_help(my_long_options);
   my_print_variables(my_long_options);
@@ -40,7 +36,7 @@ main(int argc, char** argv)
   load_defaults("my",load_default_groups,&argc,&argv);
   int ho_error;
 #ifndef DBUG_OFF
-  opt_debug= "d:t:O,/tmp/ndb_desc.trace";
+  opt_debug= "d:t:O,/tmp/eventlog.trace";
 #endif
   if ((ho_error=handle_options(&argc, &argv, my_long_options, 
 			       ndb_std_get_one_option)))

Thread
bzr push into mysql-5.1 branch (msvensson:2789 to 2790)Magnus Svensson14 Jan