List:Commits« Previous MessageNext Message »
From:tomas Date:May 9 2007 3:04pm
Subject:bk commit into 5.1 tree (tomas:1.2513)
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@stripped, 2007-05-09 15:04:45+02:00, tomas@stripped +5 -0
  Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
  into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user
  MERGE: 1.1810.2870.37

  storage/ndb/include/ndbapi/NdbRecAttr.hpp@stripped, 2007-05-09 15:03:32+02:00,
tomas@stripped +0 -0
    Auto merged
    MERGE: 1.15.8.2

  storage/ndb/include/ndbapi/NdbRecAttr.hpp@stripped, 2007-05-09 15:03:31+02:00,
tomas@stripped +0 -0
    Merge rename: ndb/include/ndbapi/NdbRecAttr.hpp ->
storage/ndb/include/ndbapi/NdbRecAttr.hpp

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2007-05-09 15:03:32+02:00,
tomas@stripped +0 -0
    Auto merged
    MERGE: 1.73.53.2

  storage/ndb/src/mgmsrv/MgmtSrvr.cpp@stripped, 2007-05-09 15:03:31+02:00,
tomas@stripped +0 -0
    Merge rename: ndb/src/mgmsrv/MgmtSrvr.cpp -> storage/ndb/src/mgmsrv/MgmtSrvr.cpp

  storage/ndb/src/ndbapi/ClusterMgr.cpp@stripped, 2007-05-09 15:03:32+02:00,
tomas@stripped +0 -0
    Auto merged
    MERGE: 1.17.14.2

  storage/ndb/src/ndbapi/ClusterMgr.cpp@stripped, 2007-05-09 15:03:31+02:00,
tomas@stripped +0 -0
    Merge rename: ndb/src/ndbapi/ClusterMgr.cpp ->
storage/ndb/src/ndbapi/ClusterMgr.cpp

  storage/ndb/src/ndbapi/ClusterMgr.hpp@stripped, 2007-05-09 15:03:32+02:00,
tomas@stripped +0 -0
    Auto merged
    MERGE: 1.4.14.2

  storage/ndb/src/ndbapi/ClusterMgr.hpp@stripped, 2007-05-09 15:03:31+02:00,
tomas@stripped +0 -0
    Merge rename: ndb/src/ndbapi/ClusterMgr.hpp ->
storage/ndb/src/ndbapi/ClusterMgr.hpp

  storage/ndb/src/ndbapi/NdbRecAttr.cpp@stripped, 2007-05-09 15:04:42+02:00,
tomas@stripped +1 -2
    manual merge
    MERGE: 1.20.17.2

  storage/ndb/src/ndbapi/NdbRecAttr.cpp@stripped, 2007-05-09 15:03:31+02:00,
tomas@stripped +0 -0
    Merge rename: ndb/src/ndbapi/NdbRecAttr.cpp ->
storage/ndb/src/ndbapi/NdbRecAttr.cpp

# 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:	whalegate.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-single-user/RESYNC

--- 1.15.8.1/ndb/include/ndbapi/NdbRecAttr.hpp	2007-05-09 14:31:20 +02:00
+++ 1.25/storage/ndb/include/ndbapi/NdbRecAttr.hpp	2007-05-09 15:03:32 +02:00
@@ -96,25 +96,9 @@
   /**
    * Get attribute (element) size in bytes. 
    * 
-   * @note For arrays, the method only gives the size of an element.
-   *       The total attribute size is calculated by 
-   *       multiplying this value with the value 
-   *       returned by NdbRecAttr::arraySize.
-   *
-   * @return Attribute size in 32 bit unsigned int. 
    */
-  Uint32 attrSize() const ;             
+  Uint32 get_size_in_bytes() const { return m_size_in_bytes; }
 
-  /**
-   * Get array size of attribute. 
-   * For variable-sized arrays this method returns the 
-   * size of the attribute read.
-   *
-   * @return array size in 32 unsigned int.
-   */
-  Uint32 arraySize() const ;            
-  Uint32 getLength() const ;
-  
   /** @} *********************************************************************/
   /** 
    * @name Getting stored value
@@ -279,7 +263,8 @@
 
   Uint32 attrId() const;        /* Get attribute id                     */
   bool setNULL();               /* Set NULL indicator                   */
-  void setUNDEFINED();          /* Set UNDEFINED indicator              */
+  void setUNDEFINED();          //
+
   bool receive_data(const Uint32*, Uint32);
 
   void release();               /* Release memory if allocated          */
@@ -302,11 +287,8 @@
 
   NdbRecAttr*   theNext;        /* Next pointer                         */
   Uint32        theAttrId;      /* The attribute id                     */
-
-  int theNULLind;
-  bool m_nullable;
-  Uint32 theAttrSize;
-  Uint32 theArraySize;
+  
+  Int32 m_size_in_bytes;
   const NdbDictionary::Column* m_column;
 
   friend struct Ndb_free_list_t<NdbRecAttr>;
@@ -327,19 +309,6 @@
 }
 
 inline
-Uint32
-NdbRecAttr::attrSize() const {
-  return theAttrSize;
-}
-
-inline
-Uint32
-NdbRecAttr::arraySize() const 
-{
-  return theArraySize;
-}
-
-inline
 Int32
 NdbRecAttr::int32_value() const 
 {
@@ -414,7 +383,6 @@
   theRef = 0;
   theNext = 0;
   theAttrId = 0xFFFF;
-  theNULLind = -1;
 }
 
 inline
@@ -463,22 +431,22 @@
 bool
 NdbRecAttr::setNULL()
 {
-  theNULLind = 1;
-  return m_nullable;
+  m_size_in_bytes= 0;
+  return true;
 }
 
 inline
-void
-NdbRecAttr::setUNDEFINED()
+int
+NdbRecAttr::isNULL() const
 {
-  theNULLind = -1;
+  return m_size_in_bytes == 0 ? 1 : (m_size_in_bytes > 0 ? 0 : -1);
 }
 
 inline
-int
-NdbRecAttr::isNULL() const
+void
+NdbRecAttr::setUNDEFINED()
 {
-  return theNULLind;
+  m_size_in_bytes= -1;
 }
 
 class NdbOut& operator <<(class NdbOut&, const NdbRecAttr &);

--- 1.73.53.1/ndb/src/mgmsrv/MgmtSrvr.cpp	2007-05-09 15:02:59 +02:00
+++ 1.130/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2007-05-09 15:03:32 +02:00
@@ -36,10 +36,10 @@
 #include <signaldata/EventReport.hpp>
 #include <signaldata/DumpStateOrd.hpp>
 #include <signaldata/BackupSignalData.hpp>
-#include <signaldata/GrepImpl.hpp>
 #include <signaldata/ManagementServer.hpp>
 #include <signaldata/NFCompleteRep.hpp>
 #include <signaldata/NodeFailRep.hpp>
+#include <signaldata/AllocNodeId.hpp>
 #include <NdbSleep.h>
 #include <EventLogger.hpp>
 #include <DebuggerNames.hpp>
@@ -66,6 +66,9 @@
 #define DEBUG(x)
 #endif
 
+int g_errorInsert;
+#define ERROR_INSERTED(x) (g_errorInsert == x)
+
 #define INIT_SIGNAL_SENDER(ss,nodeId) \
   SignalSender ss(theFacade); \
   ss.lock(); /* lock will be released on exit */ \
@@ -101,7 +104,6 @@
 extern EventLogger g_eventLogger;
 
 #ifdef NOT_USED
-
 static NdbOut&
 operator<<(NdbOut& out, const LogLevel & ll)
 {
@@ -178,6 +180,10 @@
       m_log_level_requests.lock();
     }      
     m_log_level_requests.unlock();
+
+    if(!ERROR_INSERTED(10000))
+      m_event_listner.check_listeners();
+
     NdbSleep_MilliSleep(_logLevelThreadSleep);  
   }
 }
@@ -504,10 +510,6 @@
       case NODE_TYPE_MGM:
 	nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM;
 	break;
-      case NODE_TYPE_REP:
-	nodeTypes[id] = NDB_MGM_NODE_TYPE_REP;
-	break;
-      case NODE_TYPE_EXT_REP:
       default:
 	break;
       }
@@ -590,8 +592,7 @@
       DBUG_RETURN(false);
     }
   }
-  theFacade= TransporterFacade::theFacadeInstance
-    = new TransporterFacade();
+  theFacade= new TransporterFacade();
   
   if(theFacade == 0) {
     DEBUG("MgmtSrvr.cpp: theFacade is NULL.");
@@ -998,6 +999,15 @@
   StopReq* const stopReq = CAST_PTR(StopReq, ssig.getDataPtrSend());
   ssig.set(ss, TestOrd::TraceAPI, NDBCNTR, GSN_STOP_REQ, StopReq::SignalLength);
 
+  NdbNodeBitmask notstarted;
+  for (Uint32 i = 0; i<node_ids.size(); i++)
+  {
+    Uint32 nodeId = node_ids[i];
+    ClusterMgr::Node node = theFacade->theClusterMgr->getNodeInfo(nodeId);
+    if (node.m_state.startLevel != NodeState::SL_STARTED)
+      notstarted.set(nodeId);
+  }
+  
   stopReq->requestInfo = 0;
   stopReq->apiTimeout = 5000;
   stopReq->transactionTimeout = 1000;
@@ -1136,6 +1146,9 @@
       break;
     }
     case GSN_STOP_CONF:{
+#ifdef NOT_USED
+      const StopConf * const ref = CAST_CONSTPTR(StopConf, signal->getDataPtr());
+#endif
       const NodeId nodeId = refToNode(signal->header.theSendersBlockRef);
 #ifdef VM_TRACE
       ndbout_c("Node %d single user mode", nodeId);
@@ -1165,6 +1178,15 @@
       break;
     }
     case GSN_NODE_FAILREP:{
+      const NodeFailRep * const rep =
+	CAST_CONSTPTR(NodeFailRep, signal->getDataPtr());
+      NdbNodeBitmask mask;
+      mask.assign(NdbNodeBitmask::Size, rep->theNodes);
+      mask.bitAND(notstarted);
+      nodes.bitANDC(mask);
+      
+      if (singleUserNodeId == 0)
+	stoppedNodes.bitOR(mask);
       break;
     }
     default:
@@ -1352,7 +1374,7 @@
 
   for (unsigned i = 0; i < node_ids.size(); i++)
   {
-    start(node_ids[i]);
+    (void) start(node_ids[i]);
   }
   return 0;
 }
@@ -1725,14 +1747,31 @@
 int 
 MgmtSrvr::insertError(int nodeId, int errorNo) 
 {
+  int block;
+
   if (errorNo < 0) {
     return INVALID_ERROR_NUMBER;
   }
 
-  INIT_SIGNAL_SENDER(ss,nodeId);
-  
+  SignalSender ss(theFacade);
+  ss.lock(); /* lock will be released on exit */
+
+  if(getNodeType(nodeId) == NDB_MGM_NODE_TYPE_NDB)
+  {
+    block= CMVMI;
+  }
+  else if(nodeId == _ownNodeId)
+  {
+    g_errorInsert= errorNo;
+    return 0;
+  }
+  else if(getNodeType(nodeId) == NDB_MGM_NODE_TYPE_MGM)
+    block= _blockNumber;
+  else
+    return WRONG_PROCESS_TYPE;
+
   SimpleSignal ssig;
-  ssig.set(ss,TestOrd::TraceAPI, CMVMI, GSN_TAMPER_ORD, 
+  ssig.set(ss,TestOrd::TraceAPI, block, GSN_TAMPER_ORD, 
 	   TamperOrd::SignalLength);
   TamperOrd* const tamperOrd = CAST_PTR(TamperOrd, ssig.getDataPtrSend());
   tamperOrd->errorNo = errorNo;
@@ -1958,9 +1997,6 @@
     break;
   case GSN_EVENT_REP:
   {
-    EventReport *rep = (EventReport*) signal->getDataPtr();
-    if (rep->getNodeId() == 0)
-      rep->setNodeId(refToNode(signal->theSendersBlockRef));
     eventReport(signal->getDataPtr());
     break;
   }
@@ -1970,6 +2006,10 @@
   case GSN_NODE_FAILREP:
     break;
 
+  case GSN_TAMPER_ORD:
+    ndbout << "TAMPER ORD" << endl;
+    break;
+
   default:
     g_eventLogger.error("Unknown signal received. SignalNumber: "
 			"%i from (%d, %x)",
@@ -2004,7 +2044,6 @@
       DBUG_VOID_RETURN;
     }
   }
-  
   rep->setNodeId(_ownNodeId);
   eventReport(theData);
   DBUG_VOID_RETURN;
@@ -2077,6 +2116,102 @@
   }
 }
 
+int
+MgmtSrvr::alloc_node_id_req(NodeId free_node_id, enum ndb_mgm_node_type type)
+{
+  SignalSender ss(theFacade);
+  ss.lock(); // lock will be released on exit
+
+  SimpleSignal ssig;
+  AllocNodeIdReq* req = CAST_PTR(AllocNodeIdReq, ssig.getDataPtrSend());
+  ssig.set(ss, TestOrd::TraceAPI, QMGR, GSN_ALLOC_NODEID_REQ,
+	   AllocNodeIdReq::SignalLength);
+  
+  req->senderRef = ss.getOwnRef();
+  req->senderData = 19;
+  req->nodeId = free_node_id;
+  req->nodeType = type;
+
+  int do_send = 1;
+  NodeId nodeId = 0;
+  while (1)
+  {
+    if (nodeId == 0)
+    {
+      bool next;
+      while((next = getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)) == true &&
+            theFacade->get_node_alive(nodeId) == false);
+      if (!next)
+        return NO_CONTACT_WITH_DB_NODES;
+      do_send = 1;
+    }
+    if (do_send)
+    {
+      if (ss.sendSignal(nodeId, &ssig) != SEND_OK) {
+        return SEND_OR_RECEIVE_FAILED;
+      }
+      do_send = 0;
+    }
+    
+    SimpleSignal *signal = ss.waitFor();
+
+    int gsn = signal->readSignalNumber();
+    switch (gsn) {
+    case GSN_ALLOC_NODEID_CONF:
+    {
+#ifdef NOT_USED
+      const AllocNodeIdConf * const conf =
+        CAST_CONSTPTR(AllocNodeIdConf, signal->getDataPtr());
+#endif
+      return 0;
+    }
+    case GSN_ALLOC_NODEID_REF:
+    {
+      const AllocNodeIdRef * const ref =
+        CAST_CONSTPTR(AllocNodeIdRef, signal->getDataPtr());
+      if (ref->errorCode == AllocNodeIdRef::NotMaster ||
+          ref->errorCode == AllocNodeIdRef::Busy ||
+          ref->errorCode == AllocNodeIdRef::NodeFailureHandlingNotCompleted)
+      {
+        do_send = 1;
+        nodeId = refToNode(ref->masterRef);
+	if (!theFacade->get_node_alive(nodeId))
+	  nodeId = 0;
+        if (ref->errorCode != AllocNodeIdRef::NotMaster)
+        {
+          /* sleep for a while (100ms) before retrying */
+          NdbSleep_MilliSleep(100);  
+        }
+        continue;
+      }
+      return ref->errorCode;
+    }
+    case GSN_NF_COMPLETEREP:
+    {
+      const NFCompleteRep * const rep =
+        CAST_CONSTPTR(NFCompleteRep, signal->getDataPtr());
+#ifdef VM_TRACE
+      ndbout_c("Node %d fail completed", rep->failedNodeId);
+#endif
+      if (rep->failedNodeId == nodeId)
+      {
+	do_send = 1;
+        nodeId = 0;
+      }
+      continue;
+    }
+    case GSN_NODE_FAILREP:{
+      // ignore NF_COMPLETEREP will come
+      continue;
+    }
+    default:
+      report_unknown_signal(signal);
+      return SEND_OR_RECEIVE_FAILED;
+    }
+  }
+  return 0;
+}
+
 bool
 MgmtSrvr::alloc_node_id(NodeId * nodeId, 
 			enum ndb_mgm_node_type type,
@@ -2207,6 +2342,39 @@
   }
   NdbMutex_Unlock(m_configMutex);
 
+  if (id_found && client_addr != 0)
+  {
+    int res = alloc_node_id_req(id_found, type);
+    unsigned save_id_found = id_found;
+    switch (res)
+    {
+    case 0:
+      // ok continue
+      break;
+    case NO_CONTACT_WITH_DB_NODES:
+      // ok continue
+      break;
+    default:
+      // something wrong
+      id_found = 0;
+      break;
+
+    }
+    if (id_found == 0)
+    {
+      char buf[128];
+      ndb_error_string(res, buf, sizeof(buf));
+      error_string.appfmt("Cluster refused allocation of id %d. Error: %d (%s).",
+			  save_id_found, res, buf);
+      g_eventLogger.warning("Cluster refused allocation of id %d. "
+                            "Connection from ip %s. "
+                            "Returned error string \"%s\"", save_id_found,
+                            inet_ntoa(((struct sockaddr_in
*)(client_addr))->sin_addr),
+                            error_string.c_str());
+      DBUG_RETURN(false);
+    }
+  }
+
   if (id_found)
   {
     *nodeId= id_found;
@@ -2473,7 +2641,7 @@
       const BackupCompleteRep * const rep = 
 	CAST_CONSTPTR(BackupCompleteRep, signal->getDataPtr());
 #ifdef VM_TRACE
-      ndbout_c("Backup(%d) completed %d", rep->backupId);
+      ndbout_c("Backup(%d) completed", rep->backupId);
 #endif
       event.Event = BackupEvent::BackupCompleted;
       event.Completed.BackupId = rep->backupId;
@@ -2583,17 +2751,6 @@
 }
 
 
-/*****************************************************************************
- * Global Replication
- *****************************************************************************/
-
-int
-MgmtSrvr::repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted)
-{
-  require(false);
-  return 0;
-}
-
 MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
   : m_mgmsrv(m)
 {
@@ -2742,7 +2899,7 @@
       break;
     case 1:
       res = i2.set(param, val_64);
-      ndbout_c("Updating node %d param: %d to %Ld",  node, param, val_32);
+      ndbout_c("Updating node %d param: %d to %u",  node, param, val_32);
       break;
     case 2:
       res = i2.set(param, val_char);

--- 1.17.14.1/ndb/src/ndbapi/ClusterMgr.cpp	2007-05-09 15:02:59 +02:00
+++ 1.37/storage/ndb/src/ndbapi/ClusterMgr.cpp	2007-05-09 15:03:32 +02:00
@@ -36,6 +36,7 @@
 #include <mgmapi_configuration.hpp>
 #include <mgmapi_config_parameters.h>
 
+int global_flag_skip_invalidate_cache = 0;
 //#define DEBUG_REG
 
 // Just a C wrapper for threadMain
@@ -44,15 +45,7 @@
 runClusterMgr_C(void * me)
 {
   ((ClusterMgr*) me)->threadMain();
-  /** 
-   * Sleep to allow another thread that is not exiting to take control 
-   * of signals allocated by this thread
-   *
-   * see Ndb::~Ndb() in Ndbinit.cpp
-   */  
-#ifdef NDB_OSE
-  NdbSleep_MilliSleep(50);
-#endif
+
   return NULL;
 }
 
@@ -73,6 +66,7 @@
   noOfConnectedNodes= 0;
   theClusterMgrThread= 0;
   m_connect_count = 0;
+  m_cluster_state = CS_waiting_for_clean_cache;
   DBUG_VOID_RETURN;
 }
 
@@ -113,18 +107,6 @@
     case NODE_TYPE_MGM:
       theNodes[tmp].m_info.m_type = NodeInfo::MGM;
       break;
-    case NODE_TYPE_REP:
-      theNodes[tmp].m_info.m_type = NodeInfo::REP;
-      break;
-    case NODE_TYPE_EXT_REP:
-      theNodes[tmp].m_info.m_type = NodeInfo::REP;
-      {
-	Uint32 hbFreq = 10000;
-	//ndb_mgm_get_int_parameter(iter, CFG_, &hbFreq);
-	theNodes[tmp].hbFrequency = hbFreq;
-	assert(100 <= hbFreq && hbFreq < 60 * 60 * 1000);
-      }
-      break;
     default:
       type = type;
 #if 0
@@ -251,6 +233,16 @@
     /**
      * Start of Secure area for use of Transporter
      */
+    if (m_cluster_state == CS_waiting_for_clean_cache)
+    {
+      theFacade.m_globalDictCache.lock();
+      unsigned sz= theFacade.m_globalDictCache.get_size();
+      theFacade.m_globalDictCache.unlock();
+      if (sz)
+        goto next;
+      m_cluster_state = CS_waiting_for_first_connect;
+    }
+
     theFacade.lock_mutex();
     for (int i = 1; i < MAX_NDB_NODES; i++){
       /**
@@ -299,6 +291,7 @@
      */
     theFacade.unlock_mutex();
     
+next:
     // Sleep for 100 ms between each Registration Heartbeat
     Uint64 before = now;
     NdbSleep_MilliSleep(100); 
@@ -369,8 +362,6 @@
   theFacade.sendSignalUnCond(&signal, nodeId);
 }
 
-int global_mgmt_server_check = 0; // set to one in mgmtsrvr main;
-
 void
 ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
   const ApiRegConf * const apiRegConf = (ApiRegConf *)&theData[0];
@@ -388,7 +379,7 @@
 
   if(node.m_info.m_version != apiRegConf->version){
     node.m_info.m_version = apiRegConf->version;
-    if (global_mgmt_server_check == 1)
+    if(theNodes[theFacade.ownId()].m_info.m_type == NodeInfo::MGM)
       node.compatible = ndbCompatible_mgmt_ndb(NDB_VERSION,
 					       node.m_info.m_version);
     else
@@ -407,9 +398,6 @@
   }//if
   node.m_info.m_heartbeat_cnt = 0;
   node.hbCounter = 0;
-  if (node.m_info.m_type != NodeInfo::REP) {
-    node.hbFrequency = (apiRegConf->apiHeartbeatFrequency * 10) - 50;
-  }
 
   if(waitingForHB)
   {
@@ -421,6 +409,7 @@
       NdbCondition_Broadcast(waitForHBCond);
     }
   }
+  node.hbFrequency = (apiRegConf->apiHeartbeatFrequency * 10) - 50;
 }
 
 void
@@ -478,6 +467,8 @@
 
 void
 ClusterMgr::reportConnected(NodeId nodeId){
+  DBUG_ENTER("ClusterMgr::reportConnected");
+  DBUG_PRINT("info", ("nodeId: %u", nodeId));
   /**
    * Ensure that we are sending heartbeat every 100 ms
    * until we have got the first reply from NDB providing
@@ -497,16 +488,14 @@
    * if first API_REGCONF has not arrived
    */
   theNode.m_state.m_connected_nodes.set(nodeId);
-
-  if (theNode.m_info.m_type != NodeInfo::REP) {
-    theNode.hbFrequency = 0;
-  }
+  theNode.hbFrequency = 0;
   theNode.m_info.m_version = 0;
   theNode.compatible = true;
   theNode.nfCompleteRep = true;
   theNode.m_state.startLevel = NodeState::SL_NOTHING;
   
   theFacade.ReportNodeAlive(nodeId);
+  DBUG_VOID_RETURN;
 }
 
 void
@@ -546,10 +535,14 @@
   theNode.nfCompleteRep = false;
   if(noOfAliveNodes == 0)
   {
-    theFacade.m_globalDictCache.lock();
-    theFacade.m_globalDictCache.invalidate_all();
-    theFacade.m_globalDictCache.unlock();
-    m_connect_count ++;
+    if (!global_flag_skip_invalidate_cache)
+    {
+      theFacade.m_globalDictCache.lock();
+      theFacade.m_globalDictCache.invalidate_all();
+      theFacade.m_globalDictCache.unlock();
+      m_connect_count ++;
+      m_cluster_state = CS_waiting_for_clean_cache;
+    }
     NFCompleteRep rep;
     for(Uint32 i = 1; i<MAX_NODES; i++){
       if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){

--- 1.4.14.1/ndb/src/ndbapi/ClusterMgr.hpp	2007-05-09 15:02:59 +02:00
+++ 1.20/storage/ndb/src/ndbapi/ClusterMgr.hpp	2007-05-09 15:03:32 +02:00
@@ -59,6 +59,11 @@
   class TransporterFacade & theFacade;
   
 public:
+  enum Cluster_state {
+    CS_waiting_for_clean_cache = 0,
+    CS_waiting_for_first_connect,
+    CS_connected
+  };
   struct Node {
     Node();
     bool defined;
@@ -80,6 +85,7 @@
   
   const Node &  getNodeInfo(NodeId) const;
   Uint32        getNoOfConnectedNodes() const;
+  bool          isClusterAlive() const;
   void          hb_received(NodeId);
 
   Uint32        m_connect_count;
@@ -94,6 +100,7 @@
   NdbCondition* waitForHBCond;
   bool          waitingForHB;
 
+  enum Cluster_state m_cluster_state;
   /**
    * Used for controlling start/stop of the thread
    */
@@ -138,6 +145,11 @@
 }
 
 inline
+bool
+ClusterMgr::isClusterAlive() const {
+  return noOfAliveNodes != 0;
+}
+inline
 void
 ClusterMgr::hb_received(NodeId nodeId) {
   theNodes[nodeId].m_info.m_heartbeat_cnt= 0;
@@ -183,6 +195,7 @@
     NDB_TICKS timestamp;
 
     ArbitSignal() {}
+
     inline void init(GlobalSignalNumber aGsn, const Uint32* aData) {
       gsn = aGsn;
       if (aData != NULL)

--- 1.20.17.1/ndb/src/ndbapi/NdbRecAttr.cpp	2007-05-09 14:31:20 +02:00
+++ 1.42/storage/ndb/src/ndbapi/NdbRecAttr.cpp	2007-05-09 15:04:42 +02:00
@@ -37,6 +37,7 @@
 {
   return setup(&(col->m_impl), aValue);
 }
+
 int
 NdbRecAttr::setup(const NdbColumnImpl* anAttrInfo, char* aValue)
 {
@@ -47,11 +48,8 @@
   m_column = anAttrInfo;
 
   theAttrId = anAttrInfo->m_attrId;
-  theAttrSize = tAttrSize;
-  theArraySize = tArraySize;
+  m_size_in_bytes = tAttrByteSize;
   theValue = aValue;
-  theNULLind = 0;
-  m_nullable = anAttrInfo->m_nullable;
 
   if (theStorageX)
     delete[] theStorageX;
@@ -93,7 +91,7 @@
   char* tRef = (char*)theRef;
   char* tValue = theValue;
   if (tRef != tValue && tRef != NULL && tValue != NULL) {
-    Uint32 n = theAttrSize * theArraySize;
+    Uint32 n = m_size_in_bytes;
     while (n-- > 0) {
       *tValue++ = *tRef++;
     }
@@ -109,12 +107,10 @@
     return NULL;
   }
   ret->theAttrId = theAttrId;
-  ret->theNULLind = theNULLind;
-  ret->theAttrSize = theAttrSize;
-  ret->theArraySize = theArraySize;
+  ret->m_size_in_bytes = m_size_in_bytes;
   ret->m_column = m_column;
   
-  Uint32 n = theAttrSize * theArraySize;  
+  Uint32 n = m_size_in_bytes;
   if(n <= 32){
     ret->theRef = (char*)&ret->theStorage[0];
     ret->theStorageX = 0;
@@ -135,18 +131,20 @@
 }
 
 bool
-NdbRecAttr::receive_data(const Uint32 * data, Uint32 sz){
-  const Uint32 n = (theAttrSize * theArraySize + 3) >> 2;  
-  if(n == sz){
-    theNULLind = 0;
+NdbRecAttr::receive_data(const Uint32 * data, Uint32 sz)
+{
+  if(sz)
+  {
     if(!copyoutRequired())
-      memcpy(theRef, data, 4 * sz);
+      memcpy(theRef, data, sz);
     else
-      memcpy(theValue, data, theAttrSize * theArraySize);
-    return true;
-  } else if(sz == 0){
-    setNULL();
+      memcpy(theValue, data, sz);
+    m_size_in_bytes= sz;
     return true;
+  } 
+  else 
+  {
+    return setNULL();
   }
   return false;
 }
@@ -292,15 +290,15 @@
     case NdbDictionary::Column::Binary:
       if (!f.hex_format)
         out << fields_optionally_enclosed_by;
-      j = r.arraySize();
+      j = r.get_size_in_bytes();
       ndbrecattr_print_string(out,f,"Binary", true, r.aRef(), j);
       if (!f.hex_format)
         out << fields_optionally_enclosed_by;
       break;
     case NdbDictionary::Column::Char:
       out << fields_optionally_enclosed_by;
-      j = length;
-      ndbrecattr_print_string(out,f,"Char", false, r.aRef(), r.arraySize());
+      j = r.get_size_in_bytes();
+      ndbrecattr_print_string(out,f,"Char", false, r.aRef(), j);
       out << fields_optionally_enclosed_by;
       break;
     case NdbDictionary::Column::Varchar:
@@ -433,10 +431,10 @@
       memcpy(&head, r.aRef(), sizeof(head));
       out << head.length << ":";
       const unsigned char* p = (const unsigned char*)r.aRef() + sizeof(head);
-      if (r.arraySize() < sizeof(head))
+      if (r.get_size_in_bytes() < sizeof(head))
         out << "***error***"; // really cannot happen
       else {
-        unsigned n = r.arraySize() - sizeof(head);
+        unsigned n = r.get_size_in_bytes() - sizeof(head);
         for (unsigned k = 0; k < n && k < head.length; k++) {
           if (r.getType() == NdbDictionary::Column::Blob)
             out.print("%02X", (int)p[k]);
Thread
bk commit into 5.1 tree (tomas:1.2513)tomas9 May