List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:October 13 2010 6:15am
Subject:bzr commit into mysql-5.1-telco-7.0 branch (jonas:3849)
View as plain text  
#At file:///home/jonas/src/telco-7.0/ based on revid:jonas@stripped

 3849 Jonas Oreland	2010-10-13
      ndb - create struct that keeps node-info in ndbapi, new = trp_node, old = ClusterMgr::Node

    added:
      storage/ndb/src/ndbapi/trp_node.cpp
      storage/ndb/src/ndbapi/trp_node.hpp
    modified:
      storage/ndb/src/mgmsrv/MgmtSrvr.cpp
      storage/ndb/src/ndbapi/CMakeLists.txt
      storage/ndb/src/ndbapi/ClusterMgr.cpp
      storage/ndb/src/ndbapi/ClusterMgr.hpp
      storage/ndb/src/ndbapi/Makefile.am
      storage/ndb/src/ndbapi/SignalSender.cpp
      storage/ndb/src/ndbapi/SignalSender.hpp
      storage/ndb/src/ndbapi/TransporterFacade.hpp
      storage/ndb/src/ndbapi/trp_client.hpp
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2010-10-12 14:11:45 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2010-10-13 06:15:20 +0000
@@ -869,7 +869,7 @@ MgmtSrvr::versionNode(int nodeId, Uint32
   }
   else if (getNodeType(nodeId) == NDB_MGM_NODE_TYPE_NDB)
   {
-    ClusterMgr::Node node= theFacade->theClusterMgr->getNodeInfo(nodeId);
+    trp_node node = theFacade->theClusterMgr->getNodeInfo(nodeId);
     if(node.is_connected())
     {
       version= node.m_info.m_version;
@@ -1093,7 +1093,7 @@ int MgmtSrvr::sendSTOP_REQ(const Vector<
   for (Uint32 i = 0; i<node_ids.size(); i++)
   {
     Uint32 nodeId = node_ids[i];
-    ClusterMgr::Node node = theFacade->theClusterMgr->getNodeInfo(nodeId);
+    trp_node node = ss.getNodeInfo(nodeId);
     if (node.m_state.startLevel != NodeState::SL_STARTED)
       notstarted.set(nodeId);
   }
@@ -1405,7 +1405,7 @@ int MgmtSrvr::enterSingleUser(int * stop
 int MgmtSrvr::check_nodes_stopping()
 {
   NodeId nodeId = 0;
-  ClusterMgr::Node node;
+  trp_node node;
   while(getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB))
   {
     node = theFacade->theClusterMgr->getNodeInfo(nodeId);
@@ -1421,7 +1421,7 @@ int MgmtSrvr::check_nodes_stopping()
 int MgmtSrvr::check_nodes_starting()
 {
   NodeId nodeId = 0;
-  ClusterMgr::Node node;
+  trp_node node;
   while(getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB))
   {
     node = theFacade->theClusterMgr->getNodeInfo(nodeId);
@@ -1434,7 +1434,7 @@ int MgmtSrvr::check_nodes_starting()
 int MgmtSrvr::check_nodes_single_user()
 {
   NodeId nodeId = 0;
-  ClusterMgr::Node node;
+  trp_node node;
   while(getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB))
   {
     node = theFacade->theClusterMgr->getNodeInfo(nodeId);
@@ -1672,7 +1672,7 @@ MgmtSrvr::status(int nodeId, 
     *address= get_connect_address(nodeId);
   }
 
-  const ClusterMgr::Node node = 
+  const trp_node node =
     theFacade->theClusterMgr->getNodeInfo(nodeId);
 
   if(!node.is_connected()){
@@ -2541,7 +2541,7 @@ const char *MgmtSrvr::get_connect_addres
       theFacade->theClusterMgr &&
       getNodeType(node_id) == NDB_MGM_NODE_TYPE_NDB) 
   {
-    const ClusterMgr::Node &node=
+    const trp_node &node=
       theFacade->theClusterMgr->getNodeInfo(node_id);
     if (node.is_connected())
     {
@@ -2561,7 +2561,7 @@ MgmtSrvr::get_connected_nodes(NodeBitmas
     {
       if (getNodeType(i) == NDB_MGM_NODE_TYPE_NDB)
       {
-	const ClusterMgr::Node &node= theFacade->theClusterMgr->getNodeInfo(i);
+	const trp_node &node= theFacade->theClusterMgr->getNodeInfo(i);
 	connected_nodes.bitOR(node.m_state.m_connected_nodes);
       }
     }
@@ -3904,7 +3904,7 @@ MgmtSrvr::request_events(NdbNodeBitmask 
       continue;
 
     // Only request from confirmed DB nodes
-    const ClusterMgr::Node node = ss.getNodeInfo(i);
+    const trp_node node = ss.getNodeInfo(i);
     if (node.m_info.getType() != NodeInfo::DB ||
         !node.is_confirmed())
     {

=== modified file 'storage/ndb/src/ndbapi/CMakeLists.txt'
--- a/storage/ndb/src/ndbapi/CMakeLists.txt	2010-10-05 14:27:00 +0000
+++ b/storage/ndb/src/ndbapi/CMakeLists.txt	2010-10-13 06:15:20 +0000
@@ -58,5 +58,5 @@ ADD_LIBRARY(ndbapi STATIC
             NdbInfo.cpp
             NdbInfoScanOperation.cpp
             ndb_internal.cpp
-	    trp_client.cpp)
-
+	    trp_client.cpp
+            trp_node.cpp)

=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.cpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.cpp	2010-10-06 12:35:34 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp	2010-10-13 06:15:20 +0000
@@ -229,7 +229,7 @@ ClusterMgr::forceHB()
     waitForHBFromNodes.clear();
     for(Uint32 i = 1; i < MAX_NDB_NODES; i++)
     {
-      const Node &node= getNodeInfo(i);
+      const trp_node &node= getNodeInfo(i);
       if(!node.defined)
         continue;
       if(node.m_info.getType() == NodeInfo::DB)
@@ -477,13 +477,8 @@ ClusterMgr::trp_node_status(Uint32 nodeI
 }
 
 ClusterMgr::Node::Node()
-  : m_state(NodeState::SL_NOTHING),
-    hbFrequency(0), hbCounter(0)
- {
-  compatible = nfCompleteRep = true;
-  m_connected = defined = m_alive = m_api_reg_conf = false;
-  m_state.m_connected_nodes.clear();
-  minDbVersion = 0;
+  : hbFrequency(0), hbCounter(0)
+{
 }
 
 /**
@@ -850,7 +845,7 @@ ClusterMgr::print_nodes(const char* wher
   out << where << " >>" << endl;
   for (NodeId n = 1; n < MAX_NODES ; n++)
   {
-    const Node node = getNodeInfo(n);
+    const trp_node node = getNodeInfo(n);
     if (!node.defined)
       continue;
     out << "node: " << n << endl;

=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.hpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.hpp	2010-10-01 11:43:32 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.hpp	2010-10-13 06:15:20 +0000
@@ -25,9 +25,8 @@
 #include <NdbCondition.h>
 #include <signaldata/ArbitSignalData.hpp>
 #include <signaldata/NodeStateSignalData.hpp>
-#include <NodeInfo.hpp>
-#include <NodeState.hpp>
 #include "trp_client.hpp"
+#include "trp_node.hpp"
 
 extern "C" void* runClusterMgr_C(void * me);
 
@@ -70,55 +69,18 @@ public:
     CS_waiting_for_first_connect,
     CS_connected
   };
-  struct Node {
+  struct Node : public trp_node
+  {
     Node();
-    bool defined;
-    bool compatible;    // Version is compatible
-    bool nfCompleteRep; // NF Complete Rep has arrived
-    bool m_alive;       // Node is alive
-    
-    NodeInfo  m_info;
-    NodeState m_state;
 
     /**
      * Heartbeat stuff
      */
     Uint32 hbFrequency; // Heartbeat frequence 
     Uint32 hbCounter;   // # milliseconds passed since last hb sent
-
-    /**
-     * Min db version reported by this node
-     */
-    Uint32 minDbVersion; // Minimum Db version known to node at API_REGCONF
-
-    void set_connected(bool connected) {
-      assert(defined);
-      m_connected = connected;
-    }
-    bool is_connected(void) const {
-      const bool connected = m_connected;
-      // Must be defined if connected
-      assert(!connected ||
-             (connected && defined));
-      return connected;
-    }
-
-    void set_confirmed(bool confirmed) {
-      assert(is_connected()); // Must be connected to change confirmed
-      m_api_reg_conf = confirmed;
-    }
-    bool is_confirmed(void) const {
-      const bool confirmed = m_api_reg_conf;
-      assert(!confirmed ||
-             (confirmed && is_connected()));
-      return confirmed;
-    }
-private:
-    bool m_connected;     // Transporter connected
-    bool m_api_reg_conf;// API_REGCONF has arrived
   };
   
-  const Node &  getNodeInfo(NodeId) const;
+  const trp_node & getNodeInfo(NodeId) const;
   Uint32        getNoOfConnectedNodes() const;
   void          hb_received(NodeId);
 
@@ -186,7 +148,7 @@ public:
 };
 
 inline
-const ClusterMgr::Node &
+const trp_node &
 ClusterMgr::getNodeInfo(NodeId nodeId) const {
   // Check array bounds
   assert(nodeId < MAX_NODES);

=== modified file 'storage/ndb/src/ndbapi/Makefile.am'
--- a/storage/ndb/src/ndbapi/Makefile.am	2010-10-05 14:27:00 +0000
+++ b/storage/ndb/src/ndbapi/Makefile.am	2010-10-13 06:15:20 +0000
@@ -62,7 +62,8 @@ libndbapi_la_SOURCES = \
 	NdbInfo.cpp \
 	NdbInfoScanOperation.cpp \
         ndb_internal.cpp \
-	trp_client.cpp
+	trp_client.cpp \
+        trp_node.cpp
 
 INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/src/mgmapi
 

=== modified file 'storage/ndb/src/ndbapi/SignalSender.cpp'
--- a/storage/ndb/src/ndbapi/SignalSender.cpp	2010-10-06 12:35:34 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.cpp	2010-10-13 06:15:20 +0000
@@ -119,11 +119,6 @@ SignalSender::getOwnRef() const {
   return numberToRef(m_blockNo, theFacade->ownId());
 }
 
-const ClusterMgr::Node & 
-SignalSender::getNodeInfo(Uint16 nodeId) const {
-  return theFacade->theClusterMgr->getNodeInfo(nodeId);
-}
-
 Uint32
 SignalSender::getNoOfConnectedNodes() const {
   return theFacade->theClusterMgr->getNoOfConnectedNodes();
@@ -297,7 +292,7 @@ ok:
     NdbNodeBitmask::clear(rep->theNodes);
 
     // Mark ndb nodes as failed in bitmask
-    const ClusterMgr::Node node= getNodeInfo(nodeId);
+    const trp_node node= getNodeInfo(nodeId);
     if (node.m_info.getType() ==  NodeInfo::DB)
       NdbNodeBitmask::set(rep->theNodes, nodeId);
   }
@@ -328,7 +323,7 @@ SignalSender::find_node(const NodeBitmas
 
 class FindConfirmedNode {
 public:
-  bool found_ok(const SignalSender& ss, const ClusterMgr::Node & node){
+  bool found_ok(const SignalSender& ss, const trp_node & node){
     return node.is_confirmed();
   }
 };
@@ -344,7 +339,7 @@ SignalSender::find_confirmed_node(const 
 
 class FindConnectedNode {
 public:
-  bool found_ok(const SignalSender& ss, const ClusterMgr::Node & node){
+  bool found_ok(const SignalSender& ss, const trp_node & node){
     return node.is_connected();
   }
 };
@@ -360,7 +355,7 @@ SignalSender::find_connected_node(const 
 
 class FindAliveNode {
 public:
-  bool found_ok(const SignalSender& ss, const ClusterMgr::Node & node){
+  bool found_ok(const SignalSender& ss, const trp_node & node){
     return node.m_alive;
   }
 };

=== modified file 'storage/ndb/src/ndbapi/SignalSender.hpp'
--- a/storage/ndb/src/ndbapi/SignalSender.hpp	2010-10-06 12:35:34 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.hpp	2010-10-13 06:15:20 +0000
@@ -95,7 +95,6 @@ public:
   int unlock();
 
   Uint32 getOwnRef() const;
-  const ClusterMgr::Node &getNodeInfo(Uint16 nodeId) const;
   Uint32 getNoOfConnectedNodes() const;
 
   NodeId find_confirmed_node(const NodeBitmask& mask);

=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.hpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.hpp	2010-10-06 12:35:34 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp	2010-10-13 06:15:20 +0000
@@ -204,6 +204,7 @@ private:
   /**
    * Send a signal unconditional of node status (used by ClusterMgr)
    */
+  friend class trp_client;
   friend class ClusterMgr;
   friend class ArbitMgr;
   friend class MgmtSrvr;
@@ -341,8 +342,7 @@ bool
 TransporterFacade::get_node_alive(NodeId n) const {
   if (theClusterMgr)
   {
-    const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n);
-    return node.m_alive;
+    return theClusterMgr->getNodeInfo(n).m_alive;
   }
   return 0;
 }
@@ -356,7 +356,7 @@ TransporterFacade::hb_received(NodeId n)
 inline
 bool
 TransporterFacade::get_node_stopping(NodeId n) const {
-  const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n);
+  const trp_node & node = theClusterMgr->getNodeInfo(n);
   assert(node.m_info.getType() == NodeInfo::DB);
   return (!node.m_state.getSingleUserMode() &&
           node.m_state.startLevel >= NodeState::SL_STOPPING_1);
@@ -365,7 +365,7 @@ TransporterFacade::get_node_stopping(Nod
 inline
 bool
 TransporterFacade::getIsNodeSendable(NodeId n) const {
-  const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n);
+  const trp_node & node = theClusterMgr->getNodeInfo(n);
   const Uint32 startLevel = node.m_state.startLevel;
   const NodeInfo::NodeType node_type = node.m_info.getType();
   assert(node_type == NodeInfo::DB ||
@@ -400,6 +400,13 @@ TransporterFacade::getMinDbNodeVersion()
     return 0;
 }
 
+inline
+const trp_node &
+trp_client::getNodeInfo(Uint32 nodeId) const
+{
+  return m_facade->theClusterMgr->getNodeInfo(nodeId);
+}
+
 /** 
  * LinearSectionIterator
  *

=== modified file 'storage/ndb/src/ndbapi/trp_client.hpp'
--- a/storage/ndb/src/ndbapi/trp_client.hpp	2010-10-06 12:35:34 +0000
+++ b/storage/ndb/src/ndbapi/trp_client.hpp	2010-10-13 06:15:20 +0000
@@ -21,6 +21,7 @@
 #include <ndb_global.h>
 #include <NdbCondition.h>
 
+struct trp_node;
 class NdbApiSignal;
 struct LinearSectionPtr;
 
@@ -45,6 +46,7 @@ public:
 
   void forceSend(int val = 1);
 
+  const trp_node & getNodeInfo(Uint32 i) const;
 private:
   Uint32 m_blockNo;
   TransporterFacade * m_facade;

=== added file 'storage/ndb/src/ndbapi/trp_node.cpp'
--- a/storage/ndb/src/ndbapi/trp_node.cpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/ndbapi/trp_node.cpp	2010-10-13 06:15:20 +0000
@@ -0,0 +1,27 @@
+/*
+   Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#include "trp_node.hpp"
+
+trp_node::trp_node()
+  : m_state(NodeState::SL_NOTHING)
+{
+  compatible = nfCompleteRep = true;
+  m_connected = defined = m_alive = m_api_reg_conf = false;
+  m_state.m_connected_nodes.clear();
+  minDbVersion = 0;
+}

=== added file 'storage/ndb/src/ndbapi/trp_node.hpp'
--- a/storage/ndb/src/ndbapi/trp_node.hpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/ndbapi/trp_node.hpp	2010-10-13 06:15:20 +0000
@@ -0,0 +1,66 @@
+/*
+   Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#ifndef trp_node_hpp
+#define trp_node_hpp
+
+#include <ndb_global.h>
+#include <kernel/NodeInfo.hpp>
+#include <kernel/NodeState.hpp>
+
+struct trp_node
+{
+  trp_node();
+  bool defined;
+  bool compatible;    // Version is compatible
+  bool nfCompleteRep; // NF Complete Rep has arrived
+  bool m_alive;       // Node is alive
+  Uint32 minDbVersion;
+
+  NodeInfo  m_info;
+  NodeState m_state;
+
+  void set_connected(bool connected) {
+    assert(defined);
+    m_connected = connected;
+  }
+  bool is_connected(void) const {
+    const bool connected = m_connected;
+    // Must be defined if connected
+    assert(!connected ||
+           (connected && defined));
+    return connected;
+  }
+
+  void set_confirmed(bool confirmed) {
+    assert(is_connected()); // Must be connected to change confirmed
+    m_api_reg_conf = confirmed;
+  }
+
+  bool is_confirmed(void) const {
+    const bool confirmed = m_api_reg_conf;
+    assert(!confirmed ||
+           (confirmed && is_connected()));
+    return confirmed;
+  }
+
+private:
+  bool m_connected;     // Transporter connected
+  bool m_api_reg_conf;// API_REGCONF has arrived
+};
+
+#endif


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20101013061520-hb9i2g9lq5rn3g4v.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (jonas:3849) Jonas Oreland13 Oct