List:Commits« Previous MessageNext Message »
From:tomas Date:February 12 2007 4:45am
Subject:bk commit into 5.1 tree (tomas:1.2425)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2425 07/02/12 10:45:07 tomas@stripped +18 -0
  Merge poseidon.mysql.com:/home/tomas/mysql-5.1-telco
  into  poseidon.mysql.com:/home/tomas/mysql-5.1-telco-next

  storage/ndb/src/common/transporter/TCP_Transporter.cpp
    1.16 07/02/12 10:44:58 tomas@stripped +0 -0
    SCCS merged

  storage/ndb/tools/listTables.cpp
    1.32 07/02/12 10:38:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
    1.160 07/02/12 10:38:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/ConfigInfo.cpp
    1.99 07/02/12 10:38:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
    1.54 07/02/12 10:38:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
    1.21 07/02/12 10:38:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
    1.46 07/02/12 10:38:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
    1.136 07/02/12 10:38:42 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
    1.48 07/02/12 10:38:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
    1.137 07/02/12 10:38:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
    1.59 07/02/12 10:38:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/common/transporter/TransporterRegistry.cpp
    1.70 07/02/12 10:38:41 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/common/transporter/Transporter.cpp
    1.29 07/02/12 10:38:40 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/common/transporter/TCP_Transporter.hpp
    1.10 07/02/12 10:38:40 tomas@stripped +0 -0
    Auto merged

  storage/ndb/src/common/debugger/EventLogger.cpp
    1.36 07/02/12 10:38:40 tomas@stripped +0 -0
    Auto merged

  storage/ndb/include/transporter/TransporterDefinitions.hpp
    1.21 07/02/12 10:38:40 tomas@stripped +0 -0
    Auto merged

  sql/mysqld.cc
    1.613 07/02/12 10:38:39 tomas@stripped +0 -0
    Auto merged

  sql/ha_ndbcluster.cc
    1.402 07/02/12 10:38:39 tomas@stripped +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	tomas
# Host:	poseidon.mysql.com
# Root:	/home/tomas/mysql-5.1-telco-next/RESYNC

--- 1.612/sql/mysqld.cc	2007-02-03 05:58:05 +07:00
+++ 1.613/sql/mysqld.cc	2007-02-12 10:38:39 +07:00
@@ -413,7 +413,7 @@
 char opt_ndb_constrbuf[1024];
 unsigned opt_ndb_constrbuf_len= 0;
 my_bool	opt_ndb_shm, opt_ndb_optimized_node_selection;
-ulong opt_ndb_cache_check_time;
+ulong opt_ndb_cache_check_time, opt_ndb_wait_connected;
 const char *opt_ndb_mgmd;
 ulong opt_ndb_nodeid;
 ulong ndb_extra_logging;
@@ -4769,6 +4769,7 @@
   OPT_NDB_USE_EXACT_COUNT, OPT_NDB_USE_TRANSACTIONS,
   OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
   OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME,
+  OPT_NDB_WAIT_CONNECTED,
   OPT_NDB_MGMD, OPT_NDB_NODEID,
   OPT_NDB_DISTRIBUTION,
   OPT_NDB_INDEX_STAT_ENABLE,
@@ -5489,6 +5490,10 @@
    (gptr*) &global_system_variables.ndb_use_copying_alter_table,
    (gptr*) &global_system_variables.ndb_use_copying_alter_table,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},  
+  { "ndb-wait-connected", OPT_NDB_WAIT_CONNECTED,
+    "Time (in seconds) for mysqld to wait for connection to cluster management and data
nodes.",
+    (gptr*) &opt_ndb_wait_connected, (gptr*) &opt_ndb_wait_connected,
+    0, GET_ULONG, REQUIRED_ARG, 0, 0, LONG_TIMEOUT, 0, 0, 0},
   {"new", 'n', "Use very new possible 'unsafe' functions.",
    (gptr*) &global_system_variables.new_mode,
    (gptr*) &max_system_variables.new_mode,

--- 1.20/storage/ndb/include/transporter/TransporterDefinitions.hpp	2007-01-31 14:32:12
+07:00
+++ 1.21/storage/ndb/include/transporter/TransporterDefinitions.hpp	2007-02-12 10:38:40
+07:00
@@ -120,6 +120,10 @@
   struct SectionSegment * p;
 
   SegmentedSectionPtr() {}
+  SegmentedSectionPtr(Uint32 sz_arg, Uint32 i_arg,
+                      struct SectionSegment *p_arg)
+    :sz(sz_arg), i(i_arg), p(p_arg)
+  {}
   void setNull() { p = 0;}
   bool isNull() const { return p == 0;}
 };

--- 1.35/storage/ndb/src/common/debugger/EventLogger.cpp	2007-02-06 04:13:42 +07:00
+++ 1.36/storage/ndb/src/common/debugger/EventLogger.cpp	2007-02-12 10:38:40 +07:00
@@ -976,7 +976,7 @@
   ROW(NDBStopCompleted,        LogLevel::llStartUp,     1, Logger::LL_INFO ),
   ROW(NDBStopForced,           LogLevel::llStartUp,     1, Logger::LL_ALERT ),
   ROW(NDBStopAborted,          LogLevel::llStartUp,     1, Logger::LL_INFO ),
-  ROW(StartREDOLog,            LogLevel::llStartUp,    10, Logger::LL_INFO ),
+  ROW(StartREDOLog,            LogLevel::llStartUp,     4, Logger::LL_INFO ),
   ROW(StartLog,                LogLevel::llStartUp,    10, Logger::LL_INFO ),
   ROW(UNDORecordsExecuted,     LogLevel::llStartUp,    15, Logger::LL_INFO ),
   ROW(StartReport,             LogLevel::llStartUp,     4, Logger::LL_INFO ),

--- 1.98/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2007-01-31 14:32:12 +07:00
+++ 1.99/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2007-02-12 10:38:42 +07:00
@@ -2340,7 +2340,6 @@
 	    break;
 	  case CI_BOOL:
 	    {
-	      bool tmp_bool;
 	      require(InitConfigFileParser::convertStringToBool(param._default, default_bool));
 	      require(p->put(param._fname, default_bool));
 	      break;
@@ -2348,7 +2347,6 @@
 	  case CI_INT:
 	  case CI_INT64:
 	    {
-	      Uint64 tmp_uint64;
 	      require(InitConfigFileParser::convertStringToUint64(param._default,
default_uint64));
 	      require(p->put(param._fname, default_uint64));
 	      break;
@@ -2859,7 +2857,7 @@
     Properties::Iterator it(defaults);
 
     for(const char * name = it.first(); name != NULL; name = it.next()){
-      ConfigInfo::Status st = ctx.m_info->getStatus(ctx.m_currentInfo, name);
+      (void) ctx.m_info->getStatus(ctx.m_currentInfo, name);
       if(!ctx.m_currentSection->contains(name)){
 	switch (ctx.m_info->getType(ctx.m_currentInfo, name)){
 	case ConfigInfo::CI_INT:
@@ -3490,7 +3488,7 @@
       if(!ctx.m_currentInfo->get(n, &info))
 	continue;
 
-      Uint32 id = 0;
+      id = 0;
       info->get("Id", &id);
       
       if(id == KEY_INTERNAL)
@@ -3771,6 +3769,7 @@
   Uint32 db_nodes= 0;
   Uint32 replicas= 0;
   Uint32 db_host_count= 0;
+  bool  with_arbitration_rank= false;
   ctx.m_userProperties.get(DB_TOKEN, &db_nodes);
   ctx.m_userProperties.get("NoOfReplicas", &replicas);
   if((db_nodes % replicas) != 0){
@@ -3806,83 +3805,90 @@
       tmp->get("HostName", &host);
 
       if (strcmp(type,DB_TOKEN) == 0)
-      {
-	{
-	  Uint32 ii;
-	  if (!p_db_hosts.get(host,&ii))
-	    db_host_count++;
-	  p_db_hosts.put(host,i);
-	  if (p_arbitrators.get(host,&ii))
-	  {
-	    arbitration_warning.appfmt(arbit_warn_fmt, ii, i, host);
-	    p_arbitrators.remove(host); // only one warning per db node
-	  }
-	}
-	{
-	  unsigned j;
-	  BaseString str, str2;
-	  str.assfmt("#group%d_",group);
-	  p_db_hosts.put(str.c_str(),i_group,host);
-	  str2.assfmt("##group%d_",group);
-	  p_db_hosts.put(str2.c_str(),i_group,i);
-	  for (j= 0; j < i_group; j++)
-	  {
-	    const char *other_host;
-	    p_db_hosts.get(str.c_str(),j,&other_host);
-	    if (strcmp(host,other_host) == 0) {
-	      unsigned int other_i, c= 0;
-	      p_db_hosts.get(str2.c_str(),j,&other_i);
-	      p_db_hosts.get(str.c_str(),&c);
-	      if (c == 0) // first warning in this node group
-		node_group_warning.appfmt("  Node group %d", group);
-	      c|= 1 << j;
-	      p_db_hosts.put(str.c_str(),c);
-
-	      node_group_warning.appfmt(",\n    db node with id %d and id %d "
-					"on same host %s", other_i, i, host);
-	    }
-	  }
-	  i_group++;
-	  DBUG_ASSERT(i_group <= replicas);
-	  if (i_group == replicas)
-	  {
-	    unsigned c= 0;
-	    p_db_hosts.get(str.c_str(),&c);
-	    if (c+1 == (1u << (replicas-1))) // all nodes on same machine
-	      node_group_warning.append(".\n    Host failure will "
-					"cause complete cluster shutdown.");
-	    else if (c > 0)
-	      node_group_warning.append(".\n    Host failure may "
-					"cause complete cluster shutdown.");
-	    group++;
-	    i_group= 0;
-	  }
-	}
+      { 
+        { 
+          Uint32 ii; 
+          if (!p_db_hosts.get(host,&ii)) 
+            db_host_count++; 
+          p_db_hosts.put(host,i); 
+          if (p_arbitrators.get(host,&ii)) 
+          { 
+            arbitration_warning.appfmt(arbit_warn_fmt, ii, i, host); 
+            p_arbitrators.remove(host); // only one warning per db node 
+          } 
+        } 
+        { 
+          unsigned j; 
+          BaseString str, str2; 
+          str.assfmt("#group%d_",group); 
+          p_db_hosts.put(str.c_str(),i_group,host); 
+          str2.assfmt("##group%d_",group); 
+          p_db_hosts.put(str2.c_str(),i_group,i); 
+          for (j= 0; j < i_group; j++) 
+          { 
+            const char *other_host; 
+            p_db_hosts.get(str.c_str(),j,&other_host); 
+            if (strcmp(host,other_host) == 0) { 
+              unsigned int other_i, c= 0; 
+              p_db_hosts.get(str2.c_str(),j,&other_i); 
+              p_db_hosts.get(str.c_str(),&c); 
+              if (c == 0) // first warning in this node group 
+                node_group_warning.appfmt("  Node group %d", group); 
+              c|= 1 << j; 
+              p_db_hosts.put(str.c_str(),c); 
+              node_group_warning.appfmt(",\n    db node with id %d and id %d " 
+              "on same host %s", other_i, i, host); 
+            } 
+          } 
+          i_group++; 
+          DBUG_ASSERT(i_group <= replicas); 
+          if (i_group == replicas) 
+          { 
+            unsigned c= 0; 
+            p_db_hosts.get(str.c_str(),&c); 
+            if (c+1 == (1u << (replicas-1))) // all nodes on same machine 
+              node_group_warning.append(".\n    Host failure will " 
+              "cause complete cluster shutdown."); 
+            else if (c > 0) 
+              node_group_warning.append(".\n    Host failure may " 
+              "cause complete cluster shutdown."); 
+            group++; 
+            i_group= 0; 
+          } 
+        }
       }
       else if (strcmp(type,API_TOKEN) == 0 ||
 	       strcmp(type,MGM_TOKEN) == 0)
-      {
-	Uint32 rank;
-	if(tmp->get("ArbitrationRank", &rank) && rank > 0)
-	{
-	  if(host && host[0] != 0)
-	  {
-	    Uint32 ii;
-	    p_arbitrators.put(host,i);
-	    if (p_db_hosts.get(host,&ii))
-	    {
-	      arbitration_warning.appfmt(arbit_warn_fmt, i, ii, host);
-	    }
-	  }
-	  else
-	  {
-	    arbitration_warning.appfmt(arbit_warn_fmt2, i);
-	  }
-	}
+      { 
+        Uint32 rank; 
+        if(tmp->get("ArbitrationRank", &rank) && rank > 0) 
+        { 
+          with_arbitration_rank = true;  //check whether MGM or API node configured with
rank >0 
+          if(host && host[0] != 0) 
+          { 
+            Uint32 ii; 
+            p_arbitrators.put(host,i); 
+            if (p_db_hosts.get(host,&ii)) 
+            { 
+              arbitration_warning.appfmt(arbit_warn_fmt, i, ii, host); 
+            } 
+          } 
+          else 
+          { 
+            arbitration_warning.appfmt(arbit_warn_fmt2, i); 
+          } 
+        }
       }
     }
     if (db_host_count > 1 && node_group_warning.length() > 0)
       ndbout_c("Cluster configuration warning:\n%s",node_group_warning.c_str());
+    if (!with_arbitration_rank) 
+    {
+      ndbout_c("Cluster configuration warning:" 
+         "\n  Neither %s nor %s nodes are configured with arbitrator,"
+         "\n  may cause complete cluster shutdown in case of host failure.", 
+         MGM_TOKEN, API_TOKEN);
+    }
     if (db_host_count > 1 && arbitration_warning.length() > 0)
       ndbout_c("Cluster configuration warning:%s%s",arbitration_warning.c_str(),
 	       "\n  Running arbitrator on the same host as a database node may"

--- 1.15/storage/ndb/src/common/transporter/TCP_Transporter.cpp	2007-01-25 00:57:02 +07:00
+++ 1.16/storage/ndb/src/common/transporter/TCP_Transporter.cpp	2007-02-12 10:44:58 +07:00
@@ -59,36 +59,45 @@
 #define ndbstrerror strerror
 #endif
 
+static
+void
+setIf(int& ref, Uint32 val, Uint32 def)
+{
+  if (val)
+    ref = val;
+  else
+    ref = def;
+}
+
 TCP_Transporter::TCP_Transporter(TransporterRegistry &t_reg,
-				 int sendBufSize, int maxRecvSize, 
-                                 const char *lHostName,
-                                 const char *rHostName, 
-                                 int r_port,
-				 bool isMgmConnection_arg,
-				 NodeId lNodeId,
-                                 NodeId rNodeId,
-				 NodeId serverNodeId,
-                                 bool chksm, bool signalId,
-                                 Uint32 _reportFreq) :
+				 const TransporterConfiguration* conf)
+  :
   Transporter(t_reg, tt_TCP_TRANSPORTER,
-	      lHostName, rHostName, r_port, isMgmConnection_arg,
-	      lNodeId, rNodeId, serverNodeId,
-	      0, false, chksm, signalId),
-  m_sendBuffer(sendBufSize)
+	      conf->localHostName,
+	      conf->remoteHostName,
+	      conf->s_port,
+	      conf->isMgmConnection,
+	      conf->localNodeId,
+	      conf->remoteNodeId,
+	      conf->serverNodeId,
+	      0, false, 
+	      conf->checksum,
+	      conf->signalId),
+  m_sendBuffer(conf->tcp.sendBufferSize)
 {
-  maxReceiveSize = maxRecvSize;
+  maxReceiveSize = conf->tcp.maxReceiveSize;
   
   // Initialize member variables
   theSocket     = NDB_INVALID_SOCKET;
   
   sendCount      = receiveCount = 0;
   sendSize       = receiveSize  = 0;
-  reportFreq     = _reportFreq;
-
-  sockOptRcvBufSize = 70080;
-  sockOptSndBufSize = 71540;
+  reportFreq     = 4096; 
+  
   sockOptNodelay    = 1;
-  sockOptTcpMaxSeg  = 4096;
+  setIf(sockOptRcvBufSize, conf->tcp.tcpRcvBufSize, 70080);
+  setIf(sockOptSndBufSize, conf->tcp.tcpSndBufSize, 71540);
+  setIf(sockOptTcpMaxSeg, conf->tcp.tcpMaxsegSize, 0);
 }
 
 TCP_Transporter::~TCP_Transporter() {
@@ -150,34 +159,60 @@
   return true;
 }
 
+static
 void
-TCP_Transporter::setSocketOptions(){
-  if (setsockopt(theSocket, SOL_SOCKET, SO_RCVBUF,
-                 (char*)&sockOptRcvBufSize, sizeof(sockOptRcvBufSize)) < 0) {
-#ifdef DEBUG_TRANSPORTER
-    g_eventLogger.error("The setsockopt SO_RCVBUF error code = %d", InetErrno);
-#endif
-  }//if
+set_get(NDB_SOCKET_TYPE fd, int level, int optval, const char *optname, 
+	int val)
+{
+  int actual = 0, defval = 0;
+  socklen_t len = sizeof(actual);
+
+  getsockopt(fd, level, optval, (char*)&defval, &len);
   
-  if (setsockopt(theSocket, SOL_SOCKET, SO_SNDBUF,
-                 (char*)&sockOptSndBufSize, sizeof(sockOptSndBufSize)) < 0) {
+  if (setsockopt(fd, level, optval,
+		 (char*)&val, sizeof(val)) < 0)
+  {
 #ifdef DEBUG_TRANSPORTER
-    g_eventLogger.error("The setsockopt SO_SNDBUF error code = %d", InetErrno);
+    g_eventLogger.error("setsockopt(%s, %d) errno: %d %s", 
+                        optname, val, errno, strerror(errno));
 #endif
-  }//if
+  }
   
-  //-----------------------------------------------
-  // Set the TCP_NODELAY option so also small packets are sent
-  // as soon as possible
-  //-----------------------------------------------
-  if (setsockopt(theSocket, IPPROTO_TCP, TCP_NODELAY, 
-                 (char*)&sockOptNodelay, sizeof(sockOptNodelay)) < 0) {
+  len = sizeof(actual);
+  if ((getsockopt(fd, level, optval,
+		  (char*)&actual, &len) == 0) &&
+      actual != val)
+  {
 #ifdef DEBUG_TRANSPORTER
-    g_eventLogger.error("The setsockopt TCP_NODELAY error code = %d", InetErrno);
+    g_eventLogger.error("setsockopt(%s, %d) - actual %d default: %d", 
+                        optname, val, actual, defval);
 #endif
-  }//if
+  }
+}
+
+int
+TCP_Transporter::pre_connect_options(NDB_SOCKET_TYPE sockfd)
+{
+  if (sockOptTcpMaxSeg)
+  {
+    set_get(sockfd, IPPROTO_TCP, TCP_MAXSEG, "TCP_MAXSEG", sockOptTcpMaxSeg);
+  }
+  return 0;
 }
 
+void
+TCP_Transporter::setSocketOptions(){
+
+  set_get(theSocket, SOL_SOCKET, SO_RCVBUF, "SO_RCVBUF", sockOptRcvBufSize);
+  set_get(theSocket, SOL_SOCKET, SO_SNDBUF, "SO_SNDBUF", sockOptSndBufSize);
+  set_get(theSocket, IPPROTO_TCP, TCP_NODELAY, "TCP_NODELAY", sockOptNodelay);
+
+  if (sockOptTcpMaxSeg)
+  {
+    set_get(theSocket, IPPROTO_TCP, TCP_MAXSEG, "TCP_MAXSEG", 
+	    sockOptTcpMaxSeg);
+  }
+}
 
 #ifdef NDB_WIN32
 

--- 1.9/storage/ndb/src/common/transporter/TCP_Transporter.hpp	2007-01-25 00:57:02 +07:00
+++ 1.10/storage/ndb/src/common/transporter/TCP_Transporter.hpp	2007-02-12 10:38:40 +07:00
@@ -45,17 +45,7 @@
   friend class TransporterRegistry;
 private:
   // Initialize member variables
-  TCP_Transporter(TransporterRegistry&,
-		  int sendBufferSize, int maxReceiveSize,
-		  const char *lHostName,
-		  const char *rHostName, 
-		  int r_port,
-		  bool isMgmConnection,
-		  NodeId lHostId,
-		  NodeId rHostId,
-		  NodeId serverNodeId,
-		  bool checksum, bool signalId,
-		  Uint32 reportFreq = 4096);
+  TCP_Transporter(TransporterRegistry&, const TransporterConfiguration* conf);
   
   // Disconnect, delete send buffers and receive buffer
   virtual ~TCP_Transporter();
@@ -140,6 +130,7 @@
   void setSocketOptions();
 
   static bool setSocketNonBlocking(NDB_SOCKET_TYPE aSocket);
+  virtual int pre_connect_options(NDB_SOCKET_TYPE aSocket);
   
   bool sendIsPossible(struct timeval * timeout);
 

--- 1.28/storage/ndb/src/common/transporter/Transporter.cpp	2007-01-25 00:57:02 +07:00
+++ 1.29/storage/ndb/src/common/transporter/Transporter.cpp	2007-02-12 10:38:40 +07:00
@@ -137,6 +137,10 @@
     {
       return false;
     }
+    if (pre_connect_options(m_socket_client->m_sockfd) != 0)
+    {
+      return false;
+    }
     if (strlen(localHostName) > 0)
     {
       if (m_socket_client->bind(localHostName, 0) != 0)

--- 1.69/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2007-01-25 00:57:02
+07:00
+++ 1.70/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2007-02-12 10:38:41
+07:00
@@ -280,7 +280,9 @@
   if(theTransporters[config->remoteNodeId] != NULL)
     return false;
    
-  TCP_Transporter * t = new TCP_Transporter(*this,
+  TCP_Transporter * t = new TCP_Transporter(*this, config);
+
+#if 0
 					    config->tcp.sendBufferSize,
 					    config->tcp.maxReceiveSize,
 					    config->localHostName,
@@ -292,6 +294,8 @@
 					    config->serverNodeId,
 					    config->checksum,
 					    config->signalId);
+#endif
+
   if (t == NULL) 
     return false;
   else if (!t->initTransporter()) {

--- 1.58/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2007-01-25 00:57:02 +07:00
+++ 1.59/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2007-02-12 10:38:41 +07:00
@@ -2543,6 +2543,9 @@
   void initData();
   void initRecords();
 
+  bool validate_filter(Signal*);
+  bool match_and_print(Signal*, Ptr<TcConnectionrec>);
+
   void define_backup(Signal*);
   void execDEFINE_BACKUP_REF(Signal*);
   void execDEFINE_BACKUP_CONF(Signal*);

--- 1.136/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2007-01-31 14:20:43 +07:00
+++ 1.137/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2007-02-12 10:38:41 +07:00
@@ -582,6 +582,26 @@
 {
   jamEntry();
   m_backup_ptr = RNIL;
+  DefineBackupRef* ref = (DefineBackupRef*)signal->getDataPtrSend();
+  int err_code = 0;
+  char * extra_msg = NULL;
+
+  switch(ref->errorCode){
+    case DefineBackupRef::Undefined:
+    case DefineBackupRef::FailedToSetupFsBuffers:
+    case DefineBackupRef::FailedToAllocateBuffers: 
+    case DefineBackupRef::FailedToAllocateTables: 
+    case DefineBackupRef::FailedAllocateTableMem: 
+    case DefineBackupRef::FailedToAllocateFileRecord:
+    case DefineBackupRef::FailedToAllocateAttributeRecord:
+    case DefineBackupRef::FailedInsertFileHeader: 
+    case DefineBackupRef::FailedInsertTableList: 
+      jam();
+      err_code = NDBD_EXIT_INVALID_CONFIG;
+      extra_msg = "Probably Backup parameters configuration error, Please consult the
manual";
+      progError(__LINE__, err_code, extra_msg);
+  }
+
   sendsttorryLab(signal);
 }
 
@@ -7210,7 +7230,8 @@
   TRACE_OP(regTcPtr, "ACC_ABORTCONF");
   signal->theData[0] = regTcPtr->tupConnectrec;
   EXECUTE_DIRECT(DBTUP, GSN_TUP_ABORTREQ, signal, 1);
-  
+
+  jamEntry(); 
   continueAbortLab(signal);
   return;
 }//Dblqh::execACC_ABORTCONF()
@@ -8338,7 +8359,6 @@
   const Uint32 scanLockMode = ScanFragReq::getLockMode(reqinfo);
   const Uint8 keyinfo = ScanFragReq::getKeyinfoFlag(reqinfo);
   const Uint8 rangeScan = ScanFragReq::getRangeScanFlag(reqinfo);
-  const Uint8 tupScan = ScanFragReq::getTupScanFlag(reqinfo);
   
   ptrCheckGuard(tabptr, ctabrecFileSize, tablerec);
   if(tabptr.p->tableStatus != Tablerec::TABLE_DEFINED){
@@ -9828,9 +9848,11 @@
   const Uint32 scanOp = scanP->m_curr_batch_size_rows;
   const Uint32 nodeId = refToNode(ref);
   const bool connectedToNode = getNodeInfo(nodeId).m_connected;
-  //const Uint32 type = getNodeInfo(nodeId).m_type;
-  //const bool is_api= (type >= NodeInfo::API && type <= NodeInfo::REP);
-  //const bool old_dest= (getNodeInfo(nodeId).m_version < MAKE_VERSION(3,5,0));
+#ifdef NOT_USED
+  const Uint32 type = getNodeInfo(nodeId).m_type;
+  const bool is_api= (type >= NodeInfo::API && type <= NodeInfo::REP);
+  const bool old_dest= (getNodeInfo(nodeId).m_version < MAKE_VERSION(3,5,0));
+#endif
   const bool longable = true; // TODO is_api && !old_dest;
 
   Uint32 * dst = keyInfo->keyData;
@@ -9931,7 +9953,9 @@
     return;
   }
   ScanFragConf * conf = (ScanFragConf*)&signal->theData[0];
-  //NodeId tc_node_id= refToNode(tcConnectptr.p->clientBlockref);
+#ifdef NOT_USED
+  NodeId tc_node_id= refToNode(tcConnectptr.p->clientBlockref);
+#endif
   Uint32 trans_id1= tcConnectptr.p->transid[0];
   Uint32 trans_id2= tcConnectptr.p->transid[1];
 
@@ -15202,8 +15226,6 @@
 2.5 TEMPORARY VARIABLES
 -----------------------
 */
-  UintR tdebug;
-
   jamEntry();
   //logPagePtr.i = signal->theData[0];
   //tdebug = logPagePtr.p->logPageWord[0];

--- 1.47/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2007-01-25 00:57:03 +07:00
+++ 1.48/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2007-02-12 10:38:41 +07:00
@@ -1387,6 +1387,9 @@
                        TcConnectRecord * const regTcPtr);
   void sendTCKEY_FAILREF(Signal* signal, const ApiConnectRecord *);
   void sendTCKEY_FAILCONF(Signal* signal, ApiConnectRecord *);
+  void routeTCKEY_FAILREFCONF(Signal* signal, const ApiConnectRecord *, 
+			      Uint32 gsn, Uint32 len);
+  void execTCKEY_FAILREFCONF_R(Signal* signal);
   void checkStartTimeout(Signal* signal);
   void checkStartFragTimeout(Signal* signal);
   void timeOutFoundFragLab(Signal* signal, Uint32 TscanConPtr);
@@ -1856,6 +1859,9 @@
     Uint32 oldTimeOutValue;
   };
   AbortAllRecord c_abortRec;
+
+  bool validate_filter(Signal*);
+  bool match_and_print(Signal*, ApiConnectRecordPtr);
 
   /************************** API CONNECT RECORD ***********************/
   /* *******************************************************************/

--- 1.135/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2007-01-31 14:32:12 +07:00
+++ 1.136/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2007-02-12 10:38:42 +07:00
@@ -2523,7 +2523,7 @@
   ApiConnectRecord * const regApiPtr = &localApiConnectRecord[TapiIndex];
   apiConnectptr.p = regApiPtr;
 
-  Uint32 TstartFlag = tcKeyReq->getStartFlag(Treqinfo);
+  Uint32 TstartFlag = TcKeyReq::getStartFlag(Treqinfo);
   Uint32 TexecFlag = TcKeyReq::getExecuteFlag(Treqinfo);
 
   Uint8 isIndexOp = regApiPtr->isIndexOp;
@@ -2693,14 +2693,14 @@
   /*                                                                        */
   /* ---------------------------------------------------------------------- */
 
-  UintR TapiVersionNo = tcKeyReq->getAPIVersion(tcKeyReq->attrLen);
+  UintR TapiVersionNo = TcKeyReq::getAPIVersion(tcKeyReq->attrLen);
   UintR Tlqhkeyreqrec = regApiPtr->lqhkeyreqrec;
   regApiPtr->lqhkeyreqrec = Tlqhkeyreqrec + 1;
   regCachePtr->apiVersionNo = TapiVersionNo;
 
   UintR TapiConnectptrIndex = apiConnectptr.i;
   UintR TsenderData = tcKeyReq->senderData;
-  UintR TattrLen = tcKeyReq->getAttrinfoLen(tcKeyReq->attrLen);
+  UintR TattrLen = TcKeyReq::getAttrinfoLen(tcKeyReq->attrLen);
   UintR TattrinfoCount = c_counters.cattrinfoCount;
 
   regTcPtr->apiConnect = TapiConnectptrIndex;
@@ -2726,15 +2726,15 @@
 
   UintR TtabptrIndex = localTabptr.i;
   UintR TtableSchemaVersion = tcKeyReq->tableSchemaVersion;
-  Uint8 TOperationType = tcKeyReq->getOperationType(Treqinfo);
+  Uint8 TOperationType = TcKeyReq::getOperationType(Treqinfo);
   regCachePtr->tableref = TtabptrIndex;
   regCachePtr->schemaVersion = TtableSchemaVersion;
   regTcPtr->operation = TOperationType;
 
-  Uint8 TSimpleFlag         = tcKeyReq->getSimpleFlag(Treqinfo);
-  Uint8 TDirtyFlag          = tcKeyReq->getDirtyFlag(Treqinfo);
-  Uint8 TInterpretedFlag    = tcKeyReq->getInterpretedFlag(Treqinfo);
-  Uint8 TDistrKeyFlag       = tcKeyReq->getDistributionKeyFlag(Treqinfo);
+  Uint8 TSimpleFlag         = TcKeyReq::getSimpleFlag(Treqinfo);
+  Uint8 TDirtyFlag          = TcKeyReq::getDirtyFlag(Treqinfo);
+  Uint8 TInterpretedFlag    = TcKeyReq::getInterpretedFlag(Treqinfo);
+  Uint8 TDistrKeyFlag       = TcKeyReq::getDistributionKeyFlag(Treqinfo);
   Uint8 TNoDiskFlag         = TcKeyReq::getNoDiskFlag(Treqinfo);
   Uint8 TexecuteFlag        = TexecFlag;
   
@@ -2750,10 +2750,10 @@
   Uint32 TkeyIndex;
   Uint32* TOptionalDataPtr = (Uint32*)&tcKeyReq->scanInfo;
   {
-    Uint32  TDistrGHIndex    = tcKeyReq->getScanIndFlag(Treqinfo);
+    Uint32  TDistrGHIndex    = TcKeyReq::getScanIndFlag(Treqinfo);
     Uint32  TDistrKeyIndex   = TDistrGHIndex;
 
-    Uint32 TscanInfo = tcKeyReq->getTakeOverScanInfo(TOptionalDataPtr[0]);
+    Uint32 TscanInfo = TcKeyReq::getTakeOverScanInfo(TOptionalDataPtr[0]);
 
     regCachePtr->scanTakeOverInd = TDistrGHIndex;
     regCachePtr->scanInfo = TscanInfo;
@@ -2775,7 +2775,7 @@
   regCachePtr->keydata[2] = Tdata3;
   regCachePtr->keydata[3] = Tdata4;
 
-  TkeyLength = tcKeyReq->getKeyLength(Treqinfo);
+  TkeyLength = TcKeyReq::getKeyLength(Treqinfo);
   Uint32 TAIDataIndex;
   if (TkeyLength > 8) {
     TAIDataIndex = TkeyIndex + 8;
@@ -2788,7 +2788,7 @@
   }//if
   Uint32* TAIDataPtr = &TOptionalDataPtr[TAIDataIndex];
 
-  titcLenAiInTckeyreq = tcKeyReq->getAIInTcKeyReq(Treqinfo);
+  titcLenAiInTckeyreq = TcKeyReq::getAIInTcKeyReq(Treqinfo);
   regCachePtr->keylen = TkeyLength;
   regCachePtr->lenAiInTckeyreq = titcLenAiInTckeyreq;
   regCachePtr->currReclenAi = titcLenAiInTckeyreq;
@@ -2859,14 +2859,14 @@
     }//switch
   }//if
   
-  Uint32 TabortOption = tcKeyReq->getAbortOption(Treqinfo);
+  Uint32 TabortOption = TcKeyReq::getAbortOption(Treqinfo);
   regTcPtr->m_execAbortOption = TabortOption;
   
   /*-------------------------------------------------------------------------
    * Check error handling per operation
    * If CommitFlag is set state accordingly and check for early abort
    *------------------------------------------------------------------------*/
-  if (tcKeyReq->getCommitFlag(Treqinfo) == 1) {
+  if (TcKeyReq::getCommitFlag(Treqinfo) == 1) {
     ndbrequire(TexecuteFlag);
     regApiPtr->apiConnectstate = CS_REC_COMMITTING;
   } else {
@@ -11824,7 +11824,7 @@
   // If operation is readTupleExclusive or updateTuple then read index 
   // table with exclusive lock
   Uint32 indexLength = TcKeyReq::getKeyLength(tcIndxRequestInfo);
-  Uint32 attrLength = tcIndxReq->attrLen;
+  Uint32 attrLength = TcKeyReq::getAttrinfoLen(tcIndxReq->attrLen);
   indexOp->expectedKeyInfo = indexLength;
   Uint32 includedIndexLength = MIN(indexLength, indexBufSize);
   indexOp->expectedAttrInfo = attrLength;

--- 1.45/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2007-01-31 14:30:20 +07:00
+++ 1.46/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2007-02-12 10:38:42 +07:00
@@ -853,7 +853,6 @@
    */
   const bool allNodes = c_start.m_waiting.equal(c_allDefinedNodes);
   const bool allClusterNodes = c_start.m_waiting.equal(c_clusterNodes);
-  const Uint64 now = NdbTick_CurrentMillisecond();
 
   if(!allClusterNodes){
     jam();
@@ -1425,7 +1424,6 @@
   const bool tMasterFailed = allFailed.get(cmasterNodeId);
   const bool tStarted = !failedStarted.isclear();
   const bool tStarting = !failedStarting.isclear();
-  const bool tWaiting = !failedWaiting.isclear();
 
   if(tMasterFailed){
     jam();
@@ -2514,8 +2512,6 @@
 
 void Ndbcntr::execABORT_ALL_REF(Signal* signal){
   jamEntry();
-  AbortAllRef *abortAllRef = (AbortAllRef *)&signal->theData[0];
-  AbortAllRef::ErrorCode errorCode = (AbortAllRef::ErrorCode) abortAllRef->errorCode;
 
   StopRef * const stopRef = (StopRef *)&signal->theData[0];
   stopRef->senderData = c_stopRec.stopReq.senderData;

--- 1.20/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2007-01-31 14:21:38 +07:00
+++ 1.21/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2007-02-12 10:38:42 +07:00
@@ -105,6 +105,7 @@
   };
 
   struct StartRecord {
+    StartRecord() {}
     void reset(){ 
       m_startKey++; 
       m_startNode = 0; 
@@ -128,6 +129,7 @@
     Uint32 m_president_candidate_gci;
     Uint16 m_regReqReqSent;
     Uint16 m_regReqReqRecv;
+    Uint32 m_node_gci[MAX_NDB_NODES];
   } c_start;
   
   NdbNodeBitmask c_definedNodes; // DB nodes in config
@@ -173,6 +175,7 @@
   };
 
   struct ArbitRec {
+    ArbitRec() {}
     ArbitState state;		// state
     bool newstate;		// flag to initialize new state
     unsigned thread;		// identifies a continueB "thread"

--- 1.53/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2007-01-31 14:21:38 +07:00
+++ 1.54/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2007-02-12 10:38:42 +07:00
@@ -873,7 +873,6 @@
   jamEntry();
 
   const CmRegConf * const cmRegConf = (CmRegConf *)&signal->theData[0];
-  Uint32 presidentNodeId = cmRegConf->presidentNodeId;
 
   if (!ndbCompatible_ndb_ndb(NDB_VERSION, cmRegConf->presidentVersion)) {
     jam();
@@ -1118,7 +1117,8 @@
     jam();
     c_start.m_starting_nodes_w_log.set(TaddNodeno);
   }
-  
+  c_start.m_node_gci[TaddNodeno] = node_gci;
+
   skip_nodes.bitAND(c_definedNodes);
   c_start.m_skip_nodes.bitOR(skip_nodes);
   
@@ -1267,6 +1267,7 @@
   wait.bitANDC(tmp);
 
   Uint32 retVal = 0;
+  Uint32 incompleteng = MAX_NDB_NODES; // Illegal value
   NdbNodeBitmask report_mask;
 
   if ((c_start.m_latest_gci == 0) || 
@@ -1299,7 +1300,6 @@
       /**
        * Check for missing node group directly
        */
-      char buf[100];
       NdbNodeBitmask check;
       check.assign(c_definedNodes);
       check.bitANDC(c_start.m_starting_nodes);    // Not connected nodes
@@ -1352,7 +1352,7 @@
         report_mask.assign(c_definedNodes);
         report_mask.bitANDC(c_start.m_starting_nodes);
         retVal = 1;
-        goto start_report;
+        goto check_log;
       case CheckNodeGroups::Partitioning:
         ndbrequire(result != CheckNodeGroups::Lose);
         signal->theData[1] = 
@@ -1360,7 +1360,7 @@
         report_mask.assign(c_definedNodes);
         report_mask.bitANDC(c_start.m_starting_nodes);
         retVal = 1;
-        goto start_report;
+        goto check_log;
       }
     }
 
@@ -1384,12 +1384,7 @@
     case CheckNodeGroups::Partitioning:
       if (now < partitioned_timeout && result != CheckNodeGroups::Win)
       {
-        signal->theData[1] = c_restartPartionedTimeout == (Uint32) ~0 ? 4 : 5;
-        signal->theData[2] = Uint32((partitioned_timeout - now + 500) / 1000);
-        report_mask.assign(c_definedNodes);
-        report_mask.bitANDC(c_start.m_starting_nodes);
-        retVal = 0;
-        goto start_report;
+        goto missinglog;
       }
       // Fall through...
     case CheckNodeGroups::Win:
@@ -1397,12 +1392,61 @@
         all ? 0x8001 : (result == CheckNodeGroups::Win ? 0x8002 : 0x8003);
       report_mask.assign(c_definedNodes);
       report_mask.bitANDC(c_start.m_starting_nodes);
-      retVal = 1;
-      goto start_report;
+      retVal = 2;
+      goto check_log;
     }
   }
   ndbrequire(false);
 
+check_log:
+  jam();
+  {
+    Uint32 save[4+4*NdbNodeBitmask::Size];
+    memcpy(save, signal->theData, sizeof(save));
+    
+    signal->theData[0] = 0;
+    c_start.m_starting_nodes.copyto(NdbNodeBitmask::Size, signal->theData+1);
+    memcpy(signal->theData+1+NdbNodeBitmask::Size, c_start.m_node_gci,
+	   4*MAX_NDB_NODES);
+    EXECUTE_DIRECT(DBDIH, GSN_DIH_RESTARTREQ, signal, 
+		   1+NdbNodeBitmask::Size+MAX_NDB_NODES);
+    
+    incompleteng = signal->theData[0];
+    memcpy(signal->theData, save, sizeof(save));
+
+    if (incompleteng != MAX_NDB_NODES)
+    {
+      jam();
+      if (retVal == 1)
+      {
+	jam();
+	goto incomplete_log;
+      }
+      else if (retVal == 2)
+      {
+	if (now <= partitioned_timeout)
+	{
+	  jam();
+	  goto missinglog;
+	}
+	else
+	{
+	  goto incomplete_log;
+	}
+      }
+      ndbrequire(false);
+    }
+  }
+  goto start_report;
+
+missinglog:
+  signal->theData[1] = c_restartPartionedTimeout == (Uint32) ~0 ? 4 : 5;
+  signal->theData[2] = Uint32((partitioned_timeout - now + 500) / 1000);
+  report_mask.assign(c_definedNodes);
+  report_mask.bitANDC(c_start.m_starting_nodes);
+  retVal = 0;
+  goto start_report;
+  
 start_report:
   jam();
   {
@@ -1421,17 +1465,32 @@
   
 missing_nodegroup:
   jam();
-  char buf[100], mask1[100], mask2[100];
-  c_start.m_starting_nodes.getText(mask1);
-  tmp.assign(c_start.m_starting_nodes);
-  tmp.bitANDC(c_start.m_starting_nodes_w_log);
-  tmp.getText(mask2);
-  BaseString::snprintf(buf, sizeof(buf),
-		       "Unable to start missing node group! "
-		       " starting: %s (missing fs for: %s)",
-		       mask1, mask2);
-  progError(__LINE__, NDBD_EXIT_SR_RESTARTCONFLICT, buf);
-  return 0;                                     // Deadcode
+  {
+    char buf[100], mask1[100], mask2[100];
+    c_start.m_starting_nodes.getText(mask1);
+    tmp.assign(c_start.m_starting_nodes);
+    tmp.bitANDC(c_start.m_starting_nodes_w_log);
+    tmp.getText(mask2);
+    BaseString::snprintf(buf, sizeof(buf),
+			 "Unable to start missing node group! "
+			 " starting: %s (missing fs for: %s)",
+			 mask1, mask2);
+    progError(__LINE__, NDBD_EXIT_INSUFFICENT_NODES, buf);
+    return 0;                                     // Deadcode
+  }
+
+incomplete_log:
+  jam();
+  {
+    char buf[100], mask1[100];
+    c_start.m_starting_nodes.getText(mask1);
+    BaseString::snprintf(buf, sizeof(buf),
+			 "Incomplete log for node group: %d! "
+			 " starting nodes: %s",
+			 incompleteng, mask1);
+    progError(__LINE__, NDBD_EXIT_INSUFFICENT_NODES, buf);
+    return 0;                                     // Deadcode
+  }
 }
 
 void

--- 1.159/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2007-01-29 06:47:32 +07:00
+++ 1.160/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2007-02-12 10:38:42 +07:00
@@ -4063,17 +4063,217 @@
   DBUG_VOID_RETURN;
 }
 
+#include <NdbScanOperation.hpp>
+#include <NdbSleep.h>
+static int scanEventTable(Ndb* pNdb, 
+                          const NdbDictionary::Table* pTab,
+                          NdbDictionary::Dictionary::List &list)
+{
+  int                  retryAttempt = 0;
+  const int            retryMax = 100;
+  int                  check;
+  NdbTransaction       *pTrans = NULL;
+  NdbScanOperation     *pOp = NULL;
+  NdbRecAttr *event_name, *event_id;
+  NdbError err;
+
+  while (true)
+  {
+    NdbDictionary::Dictionary::List tmp_list;
+
+    if (retryAttempt)
+    {
+      if (retryAttempt >= retryMax)
+      {
+        ndbout << "ERROR: has retried this operation " << retryAttempt 
+               << " times, failing!" << endl;
+        goto error;
+      }
+      if (pTrans)
+        pNdb->closeTransaction(pTrans);
+      NdbSleep_MilliSleep(50);
+    }
+    retryAttempt++;
+    pTrans = pNdb->startTransaction();
+    if (pTrans == NULL)
+    {
+      if (pNdb->getNdbError().status == NdbError::TemporaryError)
+        continue;
+      goto error;
+    }
+
+    Uint64 row_count = 0;
+    {
+      if ((pOp = pTrans->getNdbScanOperation(pTab->getName())) == NULL)
+        goto error;
+      if (pOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 1) != 0)
+        goto error;
+      if (pOp->interpret_exit_last_row() == -1)
+        goto error;
+
+      Uint64 tmp;
+      pOp->getValue(NdbDictionary::Column::ROW_COUNT, (char*)&tmp);
+      if (pTrans->execute(NdbTransaction::NoCommit) == -1)
+        goto error;
+
+      int eof;
+      while ((eof = pOp->nextResult(true)) == 0)
+        row_count += tmp;
+    
+      if (eof == -1)
+      {
+        if (pTrans->getNdbError().status == NdbError::TemporaryError)
+          continue;
+        goto error;
+      }
+    }
+
+    if ((pOp = pTrans->getNdbScanOperation(pTab->getName())) == NULL)
+      goto error;
+
+    if (pOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 1) != 0)
+      goto error;
+    
+    if (pOp->interpret_exit_ok() == -1)
+      goto error;
+    
+    if ((event_id   = pOp->getValue(6)) == 0 ||
+        (event_name = pOp->getValue(0u)) == 0)
+      goto error;
+
+    if (pTrans->execute(NdbTransaction::NoCommit) == -1)
+    {
+      const NdbError err = pTrans->getNdbError();
+      if (err.status == NdbError::TemporaryError)
+        continue;
+      goto error;
+    }
+
+    tmp_list.count = row_count;
+    tmp_list.elements =
+      new NdbDictionary::Dictionary::List::Element[row_count];
+
+    int eof;
+    unsigned rows = 0;
+    while((eof = pOp->nextResult()) == 0)
+    {
+      if (rows < tmp_list.count)
+      {
+        NdbDictionary::Dictionary::List::Element &el = tmp_list.elements[rows];
+        el.id = event_id->u_32_value();
+        el.type = NdbDictionary::Object::TableEvent;
+        el.state = NdbDictionary::Object::StateOnline;
+        el.store = NdbDictionary::Object::StorePermanent;
+        el.name = strdup(event_name->aRef());
+      }
+      rows++;
+    }
+    if (eof == -1)
+    {
+      if (pTrans->getNdbError().status == NdbError::TemporaryError)
+        continue;
+      goto error;
+    }
+
+    pNdb->closeTransaction(pTrans);
+
+    if (rows < tmp_list.count)
+      tmp_list.count = rows;
+
+    list = tmp_list;
+    tmp_list.count = 0;
+    tmp_list.elements = NULL;
+
+    return 0;
+  }
+error:
+  int error_code;
+  if (pTrans)
+  {
+    error_code = pTrans->getNdbError().code;
+    pNdb->closeTransaction(pTrans);
+  }
+  else
+    error_code = pNdb->getNdbError().code;
+
+  return error_code;
+}
+
+int
+NdbDictionaryImpl::listEvents(List& list)
+{
+  int error_code;
+
+  BaseString currentDb(m_ndb.getDatabaseName());
+  BaseString currentSchema(m_ndb.getDatabaseSchemaName());
+
+  m_ndb.setDatabaseName("sys");
+  m_ndb.setDatabaseSchemaName("def");
+
+  const NdbDictionary::Table* pTab =
+    m_facade->getTable("NDB$EVENTS_0");
+
+  if(pTab == NULL)
+    error_code = m_facade->getNdbError().code;
+  else
+    error_code = scanEventTable(&m_ndb, pTab, list);
+
+  m_ndb.setDatabaseName(currentDb.c_str());
+  m_ndb.setDatabaseSchemaName(currentSchema.c_str());
+  if (error_code)
+  {
+    m_error.code = error_code;
+    return -1;
+  }
+  return 0;
+}
+
 /*****************************************************************
  * List objects or indexes
  */
 int
 NdbDictionaryImpl::listObjects(List& list, NdbDictionary::Object::Type type)
 {
+  int ret;
+  List list1, list2;
+  if (type == NdbDictionary::Object::TableEvent)
+    return listEvents(list);
+
+  if (type == NdbDictionary::Object::TypeUndefined)
+  {
+    ret = listEvents(list2);
+    if (ret)
+      return ret;
+  }
+
   ListTablesReq req;
   req.requestData = 0;
   req.setTableType(getKernelConstant(type, objectTypeMapping, 0));
   req.setListNames(true);
-  return m_receiver.listObjects(list, req.requestData, m_ndb.usingFullyQualifiedNames());
+  if (!list2.count)
+    return m_receiver.listObjects(list, req.requestData,
+                                  m_ndb.usingFullyQualifiedNames());
+  ret = m_receiver.listObjects(list1, req.requestData,
+                               m_ndb.usingFullyQualifiedNames());
+  if (ret)
+    return ret;
+  list.count = list1.count + list2.count;
+  list.elements = new NdbDictionary::Dictionary::List::Element[list.count];
+  unsigned i;
+  const NdbDictionary::Dictionary::List::Element null_el;
+  for (i = 0; i < list1.count; i++)
+  {
+    NdbDictionary::Dictionary::List::Element &el = list1.elements[i];
+    list.elements[i] = el;
+    el = null_el;
+  }
+  for (i = 0; i < list2.count; i++)
+  {
+    NdbDictionary::Dictionary::List::Element &el = list2.elements[i];
+    list.elements[i + list1.count] = el;
+    el = null_el;
+  }
+  return 0;
 }
 
 int

--- 1.31/storage/ndb/tools/listTables.cpp	2007-01-25 00:57:04 +07:00
+++ 1.32/storage/ndb/tools/listTables.cpp	2007-02-12 10:38:42 +07:00
@@ -141,6 +141,9 @@
 	case NdbDictionary::Object::Undofile:
 	  strcpy(type, "Undofile");
 	  break;
+        case NdbDictionary::Object::TableEvent:
+            strcpy(type, "TableEvent");
+            break;
         default:
 	  sprintf(type, "%d", (int)elt.type);
             break;

--- 1.401/sql/ha_ndbcluster.cc	2007-02-05 13:22:21 +07:00
+++ 1.402/sql/ha_ndbcluster.cc	2007-02-12 10:38:39 +07:00
@@ -47,6 +47,7 @@
 extern my_bool opt_ndb_optimized_node_selection;
 extern const char *opt_ndbcluster_connectstring;
 extern ulong opt_ndb_cache_check_time;
+extern ulong opt_ndb_wait_connected;
 
 // ndb interface initialization/cleanup
 #ifdef  __cplusplus
@@ -192,9 +193,15 @@
 
 static int update_status_variables(Ndb_cluster_connection *c)
 {
-  ndb_cluster_node_id=         c->node_id();
-  ndb_connected_port=          c->get_connected_port();
-  ndb_connected_host=          c->get_connected_host();
+  ndb_connected_port= c->get_connected_port();
+  ndb_connected_host= c->get_connected_host();
+  if (ndb_cluster_node_id != c->node_id())
+  {
+    ndb_cluster_node_id= c->node_id();
+    sql_print_information("NDB: NodeID is %d, management server '%s:%u'",
+                          ndb_cluster_node_id, ndb_connected_host,
+                          ndb_connected_port);
+  }
   ndb_number_of_replicas=      0;
   ndb_number_of_ready_data_nodes= c->get_no_ready();
   ndb_number_of_data_nodes=     c->no_db_nodes();
@@ -6714,13 +6721,49 @@
     goto ndbcluster_init_error;
   }
 
-  if ((res= g_ndb_cluster_connection->connect(0,0,0)) == 0)
+  /* Connect to management server */
+
+  struct timeval end_time;
+  gettimeofday(&end_time, 0);
+  end_time.tv_sec+= opt_ndb_wait_connected;
+
+  while ((res= g_ndb_cluster_connection->connect(0,0,0)) == 1)
+  {
+    struct timeval now_time;
+    gettimeofday(&now_time, 0);
+    if (now_time.tv_sec > end_time.tv_sec ||
+        (now_time.tv_sec == end_time.tv_sec &&
+         now_time.tv_usec >= end_time.tv_usec))
+      break;
+    sleep(1);
+  }
+
+  if (res == 0)
   {
     connect_callback();
     DBUG_PRINT("info",("NDBCLUSTER storage engine at %s on port %d",
                        g_ndb_cluster_connection->get_connected_host(),
                        g_ndb_cluster_connection->get_connected_port()));
-    g_ndb_cluster_connection->wait_until_ready(10,3);
+    {
+      struct timeval now_time;
+      gettimeofday(&now_time, 0);
+      ulong wait_until_ready_time= end_time.tv_sec - now_time.tv_sec;
+      if (wait_until_ready_time < 1)
+        wait_until_ready_time= 1;
+      res= g_ndb_cluster_connection->wait_until_ready(wait_until_ready_time,3);
+    }
+    if (res == 0)
+    {
+      sql_print_information("NDB: all storage nodes connected");
+    }
+    else if (res > 0)
+    {
+      sql_print_information("NDB: some storage nodes connected");
+    }
+    else if (res < 0)
+    {
+      sql_print_information("NDB: no storage nodes connected (timed out)");
+    }
   } 
   else if (res == 1)
   {
Thread
bk commit into 5.1 tree (tomas:1.2425)tomas12 Feb