List:Commits« Previous MessageNext Message »
From:gni Date:January 22 2007 12:11pm
Subject:bk commit into 4.1 tree (gni:1.2539) BUG#17788
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of root. When root 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-01-22 20:11:07+08:00, gni@stripped +7 -0
  BUG#17788 ndb_restore has more 'adaptive' functions. When the 410 temperary error occurs,
  It will send LCP immediately start signal. 

  ndb/include/ndbapi/Ndb.hpp@stripped, 2007-01-22 20:11:00+08:00, gni@stripped +1 -0
    Add the public interface for NdbImpl.

  ndb/src/ndbapi/NdbImpl.hpp@stripped, 2007-01-22 20:11:00+08:00, gni@stripped +1 -0
    Add the TranspoerterFacade member.

  ndb/src/ndbapi/Ndbinit.cpp@stripped, 2007-01-22 20:11:00+08:00, gni@stripped +1 -0
    Initialize the m_transpoerter_facade member.

  ndb/src/ndbapi/TransporterFacade.hpp@stripped, 2007-01-22 20:11:00+08:00, gni@stripped +7 -0
    Add ClusterMgr member public interface.

  ndb/tools/Makefile.am@stripped, 2007-01-22 20:11:00+08:00, gni@stripped +8 -0
    Add the header file path.

  ndb/tools/restore/consumer_restore.cpp@stripped, 2007-01-22 20:11:00+08:00, gni@stripped +61 -1
    When Redo LOG is full and  LCP isn't start, ndb_restore will send LCP immediately start signal .

  ndb/tools/restore/consumer_restore.hpp@stripped, 2007-01-22 20:11:06+08:00, gni@stripped +4 -0
    Add the interface for implementing the start LCP immediately.

# 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:	gni
# Host:	dev3-221.dev.cn.tlan
# Root:	/home/ngb/mysql/mysql-4.1/mysql-4.1-bug17788

--- 1.18/ndb/include/ndbapi/Ndb.hpp	2007-01-22 20:11:11 +08:00
+++ 1.19/ndb/include/ndbapi/Ndb.hpp	2007-01-22 20:11:11 +08:00
@@ -1386,6 +1386,7 @@
    */
   NdbConnection* hupp( NdbConnection* );
   Uint32 getReference() const { return theMyRef;}
+  NdbImpl * getImpl() const { return theImpl; }
 
   struct Free_list_usage
   {

--- 1.9/ndb/src/ndbapi/NdbImpl.hpp	2007-01-22 20:11:11 +08:00
+++ 1.10/ndb/src/ndbapi/NdbImpl.hpp	2007-01-22 20:11:11 +08:00
@@ -56,6 +56,7 @@
   ~NdbImpl();
 
   Ndb_cluster_connection_impl &m_ndb_cluster_connection;
+  TransporterFacade *m_transporter_facade;
 
   NdbDictionaryImpl m_dictionary;
 

--- 1.30/ndb/src/ndbapi/Ndbinit.cpp	2007-01-22 20:11:11 +08:00
+++ 1.31/ndb/src/ndbapi/Ndbinit.cpp	2007-01-22 20:11:11 +08:00
@@ -260,6 +260,7 @@
 		 Ndb& ndb)
   : m_ndb_cluster_connection(ndb_cluster_connection->m_impl),
     m_dictionary(ndb),
+    m_transporter_facade(ndb_cluster_connection->m_impl.m_transporter_facade),
     theCurrentConnectIndex(0),
     theNdbObjectIdMap(ndb_cluster_connection->m_impl.m_transporter_facade->theMutexPtr,
 		      1024,1024),

--- 1.22/ndb/src/ndbapi/TransporterFacade.hpp	2007-01-22 20:11:11 +08:00
+++ 1.23/ndb/src/ndbapi/TransporterFacade.hpp	2007-01-22 20:11:11 +08:00
@@ -87,6 +87,7 @@
 
   // My own processor id
   NodeId ownId() const;
+  ClusterMgr *TransporterFacade::gettheClusterMgr() const;
 
   void connected();
 
@@ -275,6 +276,12 @@
 TransporterFacade::check_send_size(Uint32 node_id, Uint32 send_size)
 {
   return true;
+}
+
+inline
+ClusterMgr*
+TransporterFacade::gettheClusterMgr() const {
+  return theClusterMgr;
 }
 
 inline

--- 1.19/ndb/tools/Makefile.am	2007-01-22 20:11:11 +08:00
+++ 1.20/ndb/tools/Makefile.am	2007-01-22 20:11:11 +08:00
@@ -34,6 +34,14 @@
                       restore/consumer_restore.cpp \
                       restore/consumer_printer.cpp \
                       restore/Restore.cpp $(tools_common_sources)
+ndb_restore_CXXFLAGS =-I$(top_srcdir)/ndb/src/mgmapi \
+                      -I$(top_srcdir)/ndb/src/mgmsrv \
+                      -I$(top_srcdir)/ndb/include/transporter \
+                      -I$(top_srcdir)/ndb/include/kernel/signaldata \
+                      -I$(top_srcdir)/ndb/include/kernel \
+                      -I$(top_srcdir)/ndb/src/ndbapi \
+                      -I$(top_srcdir)/ndb/include/mgmcommon \
+                      -DMYSQLCLUSTERDIR="\"\""
 
 ndb_config_SOURCES = ndb_config.cpp \
 	../src/mgmsrv/Config.cpp \

--- 1.14/ndb/tools/restore/consumer_restore.cpp	2007-01-22 20:11:11 +08:00
+++ 1.15/ndb/tools/restore/consumer_restore.cpp	2007-01-22 20:11:11 +08:00
@@ -18,6 +18,19 @@
 #include "consumer_restore.hpp"
 #include <NdbSleep.h>
 
+#include <SignalSender.hpp>
+#include <DumpStateOrd.hpp>
+#include <TransporterDefinitions.hpp>
+#include <mgmapi.h>
+#include <GlobalSignalNumbers.h>
+#include <NdbApiSignal.hpp>
+#include <TestOrd.hpp>
+#include <BlockNumbers.h>
+#include <GlobalSignalNumbers.h>
+#include <ClusterMgr.hpp>
+#include <NodeInfo.hpp>
+#include <math.h>
+
 extern my_bool opt_core;
 
 extern FilteredNdbOut err;
@@ -30,6 +43,7 @@
 BackupRestore::init()
 {
   release();
+  retriesForLCP = 0;
 
   if (!m_restore && !m_restore_meta)
     return true;
@@ -409,6 +423,46 @@
   }
 }
 
+Uint32  BackupRestore::getMasterNodeId(){
+  TransporterFacade *theFacade = m_ndb->getImpl()->m_transporter_facade;
+  int master_id = 0;
+  int min_dynamic_id = MAX_NODES;
+
+  for (int nodeId = 1; nodeId < MAX_NODES; nodeId++){
+    ClusterMgr::Node node = theFacade->gettheClusterMgr()->getNodeInfo(nodeId);
+    if (node.m_info.getType() == NodeInfo::DB){
+      if (node.m_state.dynamicId && node.m_info.m_version && node.connected
+         && (min_dynamic_id > (int)node.m_state.dynamicId)){
+         min_dynamic_id = node.m_state.dynamicId;
+         master_id = nodeId;
+      }
+    }
+  }
+
+  return (Uint32)master_id;
+}
+
+
+int BackupRestore::startLCPImmediately(){
+  const Uint32 len = 1;
+  SimpleSignal ssig;
+  NodeId nodeId = (NodeId)getMasterNodeId();   //send to MASTER node
+
+  TransporterFacade *m_transporter_facade = m_ndb->getImpl()->m_transporter_facade;
+  SignalSender ss(m_transporter_facade);
+  ss.lock(); /* lock will be released on exit */
+
+  DumpStateOrd * const dumpOrd =
+    CAST_PTR(DumpStateOrd, ssig.getDataPtrSend());
+  ssig.set(ss,TestOrd::TraceAPI, CMVMI, GSN_DUMP_STATE_ORD, len);
+  dumpOrd->args[0] = DumpStateOrd::DihStartLcpImmediately;  //7099
+  for(Uint32 i = 1; i<25; i++){
+    dumpOrd->args[i] = 0;
+  }
+
+  return ss.sendSignal(nodeId, &ssig) == SEND_OK ? 0 : -1;
+}
+
 /**
  * returns true if is recoverable,
  * Error handling based on hugo
@@ -428,7 +482,7 @@
     error= m_ndb->getNdbError();
   } 
 
-  Uint32 sleepTime = 100 + cb->retries * 300;
+  Uint32 sleepTime = 1000 + (int)pow(2,cb->retries) * 300;
   
   cb->retries++;
   cb->error_code = error.code;
@@ -441,6 +495,12 @@
     break;
     
   case NdbError::TemporaryError:
+    if (cb->retries > retriesForLCP){
+      retriesForLCP = cb->retries;
+      startLCPImmediately();
+    }
+    if (retriesForLCP > 8 ) retriesForLCP = 0;
+
     err << "Temporary error: " << error << endl;
     m_temp_error = true;
     NdbSleep_MilliSleep(sleepTime);

--- 1.8/ndb/tools/restore/consumer_restore.hpp	2007-01-22 20:11:11 +08:00
+++ 1.9/ndb/tools/restore/consumer_restore.hpp	2007-01-22 20:11:11 +08:00
@@ -75,6 +75,10 @@
   restore_callback_t *m_callback;
   restore_callback_t *m_free_callback;
   bool m_temp_error;
+  int startLCPImmediately();
+  Uint32 getMasterNodeId();
+
+  int  retriesForLCP;
 
   /**
    * m_new_table_ids[X] = Y;
Thread
bk commit into 4.1 tree (gni:1.2539) BUG#17788gni22 Jan