Commit 71424cb1 authored by unknown's avatar unknown
Browse files

merge


ndb/src/mgmsrv/CommandInterpreter.cpp:
  Auto merged
ndb/src/ndbapi/Ndb.cpp:
  Auto merged
ndb/src/ndbapi/NdbConnection.cpp:
  Auto merged
ndb/src/ndbapi/NdbImpl.hpp:
  Auto merged
parents 72c28731 b3dd0029
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -1586,7 +1586,6 @@ private:
/******************************************************************************
 *	These are the private variables in this class.	
 *****************************************************************************/
  NdbObjectIdMap*       theNdbObjectIdMap;
  Ndb_cluster_connection   *m_ndb_cluster_connection;

  NdbConnection**       thePreparedTransactionsArray;
@@ -1637,10 +1636,6 @@ private:
  Uint32   theMyRef;        // My block reference  
  Uint32   theNode;         // The node number of our node
  
  Uint32   theNoOfDBnodes;  // The number of DB nodes  
  Uint32 * theDBnodes;      // The node number of the DB nodes
  Uint8    *the_release_ind;// 1 indicates to release all connections to node 
  
  Uint64               the_last_check_time;
  Uint64               theFirstTransId;
  
@@ -1663,10 +1658,6 @@ private:
    InitConfigError
  } theInitState;

  // Ensure good distribution of connects
  Uint32		theCurrentConnectIndex;
  Uint32		theCurrentConnectCounter;
  
  /**
   * Computes fragement id for primary key
   *
@@ -1692,7 +1683,7 @@ private:
    Uint32 noOfFragments;
    Uint32 * fragment2PrimaryNodeMap;
    
    void init(Uint32 noOfNodes, Uint32 nodeIds[]);
    void init(Uint32 noOfNodes, Uint8 nodeIds[]);
    void release();
  } startTransactionNodeSelectionData;
  
+24 −18
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#include <ndb_version.h>
#include <version.h>
#include <basestring_vsnprintf.h>
#include <NdbEnv.h>
#include <NdbOut.hpp>

Uint32 getMajor(Uint32 version) {
  return (version >> 16) & 0xFF;
@@ -68,8 +70,27 @@ struct NdbUpGradeCompatible {

/*#define TEST_VERSION*/

#define HAVE_NDB_SETVERSION
#ifdef HAVE_NDB_SETVERSION
Uint32 ndbOwnVersionTesting = 0;
void
ndbSetOwnVersion() {
  char buf[256];
  if (NdbEnv_GetEnv("NDB_SETVERSION", buf, sizeof(buf))) {
    Uint32 _v1,_v2,_v3;
    if (sscanf(buf, "%u.%u.%u", &_v1, &_v2, &_v3) == 3) {
      ndbOwnVersionTesting = MAKE_VERSION(_v1,_v2,_v3);
      ndbout_c("Testing: Version set to 0x%x",  ndbOwnVersionTesting);
    }
  }
}
#else
void ndbSetOwnVersion() {}
#endif

#ifndef TEST_VERSION
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
  { MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact },
  { MAKE_VERSION(3,5,2), MAKE_VERSION(3,5,1), UG_Exact },
  { 0, 0, UG_Null }
};
@@ -79,8 +100,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
  { 0, 0, UG_Null }
};

void ndbSetOwnVersion() {}

#else /* testing purposes */

struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
@@ -101,19 +120,6 @@ struct NdbUpGradeCompatible ndbCompatibleTable_upgrade[] = {
};


Uint32 ndbOwnVersionTesting = 0;
void
ndbSetOwnVersion() {
  char buf[256];
  if (NdbEnv_GetEnv("NDB_SETVERSION", buf, sizeof(buf))) {
    Uint32 _v1,_v2,_v3;
    if (sscanf(buf, "%u.%u.%u", &_v1, &_v2, &_v3) == 3) {
      ndbOwnVersionTesting = MAKE_VERSION(_v1,_v2,_v3);
      ndbout_c("Testing: Version set to 0x%x",  ndbOwnVersionTesting);
    }
  }
}

#endif

void ndbPrintVersion()
@@ -127,13 +133,13 @@ void ndbPrintVersion()
Uint32
ndbGetOwnVersion()
{
#ifndef TEST_VERSION
  return NDB_VERSION_D;
#else /* testing purposes */
#ifdef HAVE_NDB_SETVERSION
  if (ndbOwnVersionTesting == 0)
    return NDB_VERSION_D;
  else
    return ndbOwnVersionTesting;
#else
  return NDB_VERSION_D;
#endif
}

+1 −536
Original line number Diff line number Diff line
@@ -30,64 +30,10 @@
#include <version.h>
#include <m_string.h>

static const char* helpTexts[] = {
  "HELP                                        Print help text",
  "HELP SHOW                                   Help for the SHOW command",
#ifdef VM_TRACE // DEBUG ONLY
  "HELP DEBUG                                  Help for debug compiled version",
#endif
  "SHOW                                        Print information about cluster",
  "SHOW CONFIG                                 Print configuration",
  "SHOW PARAMETERS                             Print configuration parameters",
  "START BACKUP                                Start backup\n"
  "ABORT BACKUP <backup id>                    Aborts backup\n"
  "CLUSTERLOG ON                               Enable Cluster logging",
  "CLUSTERLOG OFF                              Disable Cluster logging",
  "CLUSTERLOG FILTER <severity>                Toggle severity filter on/off",
  "CLUSTERLOG INFO                             Print cluster log information",
  "{<id>|ALL} START                            Start DB node (started with -n)",
  "{<id>|ALL} RESTART [-n] [-i]                Restart DB node",
  "{<id>|ALL} STOP                             Stop DB node",
  "{<id>|ALL} STATUS                           Print status",
  "{<id>|ALL} CLUSTERLOG {<category>=<level>}+ Set log level for cluster log",
  "QUIT                                        Quit management server",
};
static const unsigned noOfHelpTexts = sizeof(helpTexts)/sizeof(const char*);

static const char* helpTextShow =
"SHOW prints NDB Cluster information\n\n"
"SHOW               Print information about cluster\n" 
"SHOW CONFIG        Print configuration (in initial config file format)\n" 
"SHOW PARAMETERS    Print information about configuration parameters\n\n"
;

#ifdef VM_TRACE // DEBUG ONLY
static const char* helpTextDebug =
"SHOW PROPERTIES                             Print config properties object\n"
"{<id>|ALL} LOGLEVEL {<category>=<level>}+   Set log level\n"
"{<id>|ALL} ERROR <errorNo>                  Inject error into NDB node\n"
"{<id>|ALL} TRACE <traceNo>                  Set trace number\n"
"{<id>|ALL} LOG [BLOCK = {ALL|<block>+}]     Set logging on in & out signals\n"
"{<id>|ALL} LOGIN [BLOCK = {ALL|<block>+}]   Set logging on in signals\n"
"{<id>|ALL} LOGOUT [BLOCK = {ALL|<block>+}]  Set logging on out signals\n"
"{<id>|ALL} LOGOFF [BLOCK = {ALL|<block>+}]  Unset signal logging\n"
"{<id>|ALL} TESTON                           Start signal logging\n"
"{<id>|ALL} TESTOFF                          Stop signal logging\n"
"{<id>|ALL} SET <configParamName> <value>    Update configuration variable\n"
"{<id>|ALL} DUMP <arg>                       Dump system state to cluster.log\n"
"{<id>|ALL} GETSTAT                          Print statistics\n"
"\n"
;
#endif



//******************************************************************************
//******************************************************************************
CommandInterpreter::CommandInterpreter(MgmtSrvr& mgmtSrvr) :
  _mgmtSrvr(mgmtSrvr) {

  //  _mgmtSrvr.setCallback(CmdBackupCallback);
}


@@ -145,48 +91,7 @@ int CommandInterpreter::readAndExecute() {
  char* firstToken = strtok(line, " ");
  char* allAfterFirstToken = strtok(NULL, "\0");
  
  if (strcmp(firstToken, "HELP") == 0) {
    executeHelp(allAfterFirstToken);
    return true;
  }
  else if (strcmp(firstToken, "?") == 0) {
    executeHelp(allAfterFirstToken);
    return true;
  }
  else if (strcmp(firstToken, "SHOW") == 0) {
    executeShow(allAfterFirstToken);
    return true;
  }
  else if(strcmp(firstToken, "START") == 0 &&
	  allAfterFirstToken != 0 &&
	  strncmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
    executeStartBackup(allAfterFirstToken);
    return true;
  }
  else if(strcmp(firstToken, "ABORT") == 0 &&
	  allAfterFirstToken != 0 &&
	  strncmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
    executeAbortBackup(allAfterFirstToken);
    return true;
  }

  else if(strcmp(firstToken, "ENTER") == 0 &&
	  allAfterFirstToken != 0 &&
	  strncmp(allAfterFirstToken, "SINGLE USER MODE ", 
		  sizeof("SINGLE USER MODE") - 1) == 0){
    executeEnterSingleUser(allAfterFirstToken);
    return true;
  }

  else if(strcmp(firstToken, "EXIT") == 0 &&
	  allAfterFirstToken != 0 &&
	  strncmp(allAfterFirstToken, "SINGLE USER MODE ", 
		  sizeof("SINGLE USER MODE") - 1) == 0){
    executeExitSingleUser(allAfterFirstToken);
    return true;
  }

  else if (strcmp(firstToken, "ALL") == 0) {
  if (strcmp(firstToken, "ALL") == 0) {
    analyseAfterFirstToken(-1, allAfterFirstToken);
  } 
  else if(strcmp(firstToken, "QUIT") == 0 ||
@@ -218,8 +123,6 @@ static const CommandInterpreter::CommandFunctionPair commands[] = {
  { "START", &CommandInterpreter::executeStart }
  ,{ "RESTART", &CommandInterpreter::executeRestart }
  ,{ "STOP", &CommandInterpreter::executeStop }
  ,{ "STATUS", &CommandInterpreter::executeStatus }
  ,{ "LOGLEVEL", &CommandInterpreter::executeLogLevel }
#ifdef ERROR_INSERT
  ,{ "ERROR", &CommandInterpreter::executeError }
#endif
@@ -230,9 +133,7 @@ static const CommandInterpreter::CommandFunctionPair commands[] = {
  ,{ "LOGOFF", &CommandInterpreter::executeLogOff }
  ,{ "TESTON", &CommandInterpreter::executeTestOn }
  ,{ "TESTOFF", &CommandInterpreter::executeTestOff }
  ,{ "CLUSTERLOG", &CommandInterpreter::executeEventReporting }
  ,{ "DUMP", &CommandInterpreter::executeDumpState }
  ,{ "JONAS", &CommandInterpreter::jonas }
};


@@ -370,104 +271,9 @@ bool CommandInterpreter::parseBlockSpecification(const char* allAfterLog,
  return true;
}



//******************************************************************************
//******************************************************************************
void CommandInterpreter::executeHelp(char* parameters) {

  (void)parameters;  // Don't want compiler warning

  if (emptyString(parameters)) {
    unsigned i;
    for (i = 0; i<noOfHelpTexts; i++) {
      ndbout << helpTexts[i] << endl;
    }
    
    ndbout << endl 
	   << "<severity> = " 
	   << "ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG"
	   << endl;

    ndbout << "<category> = ";
    for(i = 0; i<CFG_MIN_LOGLEVEL; i++){
      ndbout << ndb_mgm_get_event_category_string((ndb_mgm_event_category)i);
      if (i < CFG_MIN_LOGLEVEL - 1) {
	ndbout << " | ";
      }
    }
    ndbout << endl;
    
    ndbout << "<level>    = " << "0 - 15"
	   << endl;
    
    ndbout << endl;
  } else if (strcmp(parameters, "SHOW") == 0) {
    ndbout << helpTextShow;
#ifdef VM_TRACE // DEBUG ONLY
  } else if (strcmp(parameters, "DEBUG") == 0) {
    ndbout << helpTextDebug;
#endif
  } else {
    ndbout << "Invalid argument." << endl;
  }
}

//*****************************************************************************
//*****************************************************************************

void CommandInterpreter::executeShow(char* parameters) {

  if (emptyString(parameters)) {
    ndbout << "Cluster Configuration" << endl
	   << "---------------------" << endl;
    
    NodeId nodeId = 0;
    ndbout << _mgmtSrvr.getNodeCount(NDB_MGM_NODE_TYPE_NDB) 
	   << " NDB Node(s) with" 
	   << endl;
    while (_mgmtSrvr.getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)){
      ndbout << "       Node Id = " << nodeId << endl;
    }
    ndbout << endl;
    
    nodeId = 0;
    ndbout << _mgmtSrvr.getNodeCount(NDB_MGM_NODE_TYPE_API) 
	   << " API Node(s) with" 
	   << endl;
    while (_mgmtSrvr.getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_API)){
      ndbout << "       Node Id = " << nodeId << endl;
    }
    ndbout << endl;
    
    nodeId = 0;
    ndbout << _mgmtSrvr.getNodeCount(NDB_MGM_NODE_TYPE_MGM) 
	   << " MGM Node(s) with" 
	   << endl;
    while (_mgmtSrvr.getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_MGM)){
      ndbout << "       Node Id = " << nodeId << endl;
    }
    ndbout << endl;

    ndbout << helpTextShow;

    return;
  } else if (strcmp(parameters, "PROPERTIES") == 0 ||
	     strcmp(parameters, "PROP") == 0) {
    ndbout << "_mgmtSrvr.getConfig()->print();" << endl; /* XXX */
  } else if (strcmp(parameters, "CONFIGURATION") == 0 ||
	     strcmp(parameters, "CONFIG") == 0){
    ndbout << "_mgmtSrvr.getConfigFile()->print();" << endl; /* XXX */
    _mgmtSrvr.getConfig()->printConfigFile();
  } else if (strcmp(parameters, "PARAMETERS") == 0 ||
	     strcmp(parameters, "PARAMS") == 0 ||
	     strcmp(parameters, "PARAM") == 0) {
    ndbout << "_mgmtSrvr.getConfigInfo()->print();" << endl; /* XXX */
  } else {
    ndbout << "Invalid argument." << endl;
  }
}

void
stopCallback(int nodeId, void * anyData, int errCode){
  if(errCode == 0){
@@ -483,59 +289,6 @@ stopCallback(int nodeId, void * anyData, int errCode){
  }
}

void
versionCallback(int nodeId, int version, void * anyData, int errCode){
  if(errCode == 0){
    MgmtSrvr * mgm = (MgmtSrvr *)anyData;
    switch(mgm->getNodeType(nodeId)){
    case NDB_MGM_NODE_TYPE_MGM:
      {	
	ndbout << "MGMT node:\t" << nodeId << " ";      
	  ndbout_c(" (Version %d.%d.%d)", 
		   getMajor(version) ,
		   getMinor(version),
		   getBuild(version));	  
      }
      break;
    case NDB_MGM_NODE_TYPE_NDB:
      {
	ndbout << "DB node:\t" << nodeId << " ";      
	if(version == 0)
	  ndbout << "(no version information available)" << endl;
	else {
	  ndbout_c(" (Version %d.%d.%d)", 
		   getMajor(version) ,
		   getMinor(version),
		   getBuild(version));	  
	}
      }
      break;
    case NDB_MGM_NODE_TYPE_API:
      {
	ndbout << "API node:\t" << nodeId << " ";      
	if(version == 0)
	  ndbout << "(no version information available)" << endl;
	else {
	  ndbout_c(" (Version %d.%d.%d)", 
		   getMajor(version) ,
		   getMinor(version),
		   getBuild(version));
	}
	
      }
      break;
    case NDB_MGM_NODE_TYPE_UNKNOWN:
    case NDB_MGM_NODE_TYPE_REP:
      abort();
    };
    
  } else {
    MgmtSrvr * mgm = (MgmtSrvr *)anyData;
    char err_str[1024];
    ndbout  << mgm->getErrorText(errCode,err_str,sizeof(err_str)) << endl;
  }
}

//*****************************************************************************
//*****************************************************************************
void CommandInterpreter::executeStop(int processId, 
@@ -644,124 +397,6 @@ CommandInterpreter::executeDumpState(int processId, const char* parameters,
  }
}

void CommandInterpreter::executeStatus(int processId, 
				       const char* parameters, bool all) {

  (void)all;  // Don't want compiler warning

  if (! emptyString(parameters)) {
    ndbout << "No parameters expected to this command." << endl;
    return;
  }
  
  ndb_mgm_node_status status;
  Uint32 startPhase, version, dynamicId, nodeGroup, connectCount;
  bool system;
  int result = _mgmtSrvr.status(processId, 
				&status, &version, &startPhase, &system,
				&dynamicId, &nodeGroup, &connectCount);
  if(result != 0){
    ndbout << get_error_text(result) << endl;
    return;
  }
  
  ndbout << "Node " << processId << ": ";
  switch(status){
  case NDB_MGM_NODE_STATUS_NO_CONTACT:
    ndbout << "No contact" << endl;
    break;
  case NDB_MGM_NODE_STATUS_NOT_STARTED:
    ndbout << "Not started" ;
    break;
  case NDB_MGM_NODE_STATUS_STARTING:
    ndbout << "Starting (Start phase " << startPhase << ")" ;
    break;
  case NDB_MGM_NODE_STATUS_STARTED:
    ndbout << "Started" ;
    break;
  case NDB_MGM_NODE_STATUS_SHUTTING_DOWN:
    ndbout << "Shutting down " << (system == false ? "node" : "system")
	   << " (Phase " << startPhase << ")"
	   ;
    break;
  case NDB_MGM_NODE_STATUS_RESTARTING:
    ndbout << "Restarting" ;
    break;
  case NDB_MGM_NODE_STATUS_SINGLEUSER:
    ndbout << "Single user mode" ;
    break;
  default:
    ndbout << "Unknown state" ;
    break;
  }
  if(status != NDB_MGM_NODE_STATUS_NO_CONTACT){
    
    ndbout_c(" (Version %d.%d.%d)", 
	     getMajor(version) ,
	     getMinor(version),
	     getBuild(version));
    
    // NOTE It's possible to print dynamicId  and nodeGroup here ...
    //  ndbout << ", " <<dynamicId<<", "<<nodeGroup<<endl;
  }
}



//*****************************************************************************
//*****************************************************************************
void CommandInterpreter::executeLogLevel(int processId, 
					 const char* parameters, bool all) {
#if 0
  (void)all;  // Don't want compiler warning
  SetLogLevelOrd logLevel; logLevel.clear();
  
  if (emptyString(parameters) || (strcmp(parameters, "ALL") == 0)) {
    for(Uint32 i = 0; i<EventLoggerBase::noOfEventCategoryNames; i++)
      logLevel.setLogLevel(EventLoggerBase::eventCategoryNames[i].category, 7);
  } else {

    char * tmpString = strdup(parameters);
    char * tmpPtr = 0;
    char * item = strtok_r(tmpString, ", ", &tmpPtr);
    while(item != NULL){
      char categoryTxt[255];
      int level;
      const int m = sscanf(item, "%[^=]=%d", categoryTxt, &level);
      if(m != 2){
	free(tmpString);
	ndbout << "Invalid loglevel specification category=level" << endl;
	return;
      }
      LogLevel::EventCategory cat;
      if(!EventLoggerBase::matchEventCategory(categoryTxt,
			     &cat)){
	ndbout << "Invalid loglevel specification, unknown category: " 
	       << categoryTxt << endl;
	free(tmpString);
	return ;
      }
      if(level < 0 || level > 15){
	ndbout << "Invalid loglevel specification row, level 0-15" << endl;
	free(tmpString);
	return ;
      }
      logLevel.setLogLevel(cat, level);	
      
      item = strtok_r(NULL, ", ", &tmpPtr);
    }
    free(tmpString);
  }

  int result = _mgmtSrvr.setNodeLogLevel(processId, logLevel);
  if (result != 0) {
    ndbout << get_error_text(result) << endl;
  }
#endif
}



//*****************************************************************************
//*****************************************************************************
void CommandInterpreter::executeError(int processId, 
@@ -957,173 +592,3 @@ void CommandInterpreter::executeTestOff(int processId,
  }

}

//*****************************************************************************
//*****************************************************************************
void CommandInterpreter::executeEventReporting(int processId, 
					       const char* parameters, 
					       bool all) {
#if 0
  (void)all;  // Don't want compiler warning
  SetLogLevelOrd logLevel; logLevel.clear();
  
  if (emptyString(parameters) || (strcmp(parameters, "ALL") == 0)) {
    for(Uint32 i = 0; i<EventLoggerBase::noOfEventCategoryNames; i++)
      logLevel.setLogLevel(EventLoggerBase::eventCategoryNames[i].category, 7);
  } else {

    char * tmpString = strdup(parameters);
    char * tmpPtr = 0;
    char * item = strtok_r(tmpString, ", ", &tmpPtr);
    while(item != NULL){
      char categoryTxt[255];
      int level;
      const int m = sscanf(item, "%[^=]=%d", categoryTxt, &level);
      if(m != 2){
	free(tmpString);
	ndbout << "Invalid loglevel specification category=level" << endl;
	return;
      }
      LogLevel::EventCategory cat;
      if(!EventLoggerBase::matchEventCategory(categoryTxt,
			     &cat)){
	ndbout << "Invalid loglevel specification, unknown category: " 
	       << categoryTxt << endl;
	free(tmpString);
	return ;
      }
      if(level < 0 || level > 15){
	ndbout << "Invalid loglevel specification row, level 0-15" << endl;
	free(tmpString);
	return ;
      }
      logLevel.setLogLevel(cat, level);	
      
      item = strtok_r(NULL, ", ", &tmpPtr);
    }
    free(tmpString);
  }
  ndbout_c("processId %d", processId);
  int result = _mgmtSrvr.setEventReportingLevel(processId, logLevel);
  if (result != 0) {
    ndbout << get_error_text(result) << endl;
  }
#endif
}

void
CommandInterpreter::executeStartBackup(char* parameters) {
  Uint32 backupId;
  int result = _mgmtSrvr.startBackup(backupId);
  if (result != 0) {
    ndbout << get_error_text(result) << endl;
  } else {
    //    ndbout << "Start of backup ordered" << endl;
  }
}

void
CommandInterpreter::executeAbortBackup(char* parameters) {
  strtok(parameters, " ");
  char* id = strtok(NULL, "\0");
  int bid = -1;
  if(id == 0 || sscanf(id, "%d", &bid) != 1){
    ndbout << "Invalid arguments: expected <BackupId>" << endl;
    return;
  }
  int result = _mgmtSrvr.abortBackup(bid);
  if (result != 0) {
    ndbout << get_error_text(result) << endl;
  } else {
    ndbout << "Abort of backup " << bid << " ordered" << endl;
  }
}



void
CommandInterpreter::executeEnterSingleUser(char* parameters) {
  strtok(parameters, " ");
  char* id = strtok(NULL, " ");
  id = strtok(NULL, " ");
  id = strtok(NULL, "\0");
  int nodeId = -1;
  if(id == 0 || sscanf(id, "%d", &nodeId) != 1){
    ndbout << "Invalid arguments: expected <NodeId>" << endl;
    return;
  }
  int result = _mgmtSrvr.enterSingleUser(0, nodeId,0,0);
  if (result != 0) {
    ndbout << get_error_text(result) << endl;
  } else {
    ndbout << "Entering single user mode, granting access for node " 
	   << nodeId << " OK." << endl;
  }
}

void CommandInterpreter::executeExitSingleUser(char* parameters) {
  _mgmtSrvr.exitSingleUser(0,0,0,0);
}


#include <NdbApiSignal.hpp>

void 
CommandInterpreter::jonas(int processId, const char* parameters, bool all) {

  MgmtSrvr::Area51 tmp = _mgmtSrvr.getStuff();
  
  NdbApiSignal signal(0);
  Uint32 * theData = signal.getDataPtrSend();
  Uint32 data[25];
  Uint32 sec0[70];
  Uint32 sec1[123];

  data[0] = 12;
  data[1] = 13;

  unsigned i; 
  for(i = 0; i<70; i++)
    sec0[i] = i;
  
  for(i = 0; i<123; i++)
    sec1[i] = 70+i;
  
  signal.set(0, CMVMI, GSN_TESTSIG, 3);  
  signal.m_noOfSections = 2;
  signal.m_fragmentInfo = 1;
  
  LinearSectionPtr ptr[3];

  theData[0] = 3;
  theData[1] = 0;
  theData[2] = 7; // FragmentId

  ptr[0].sz = 2;
  ptr[0].p = &data[0];
  
  ptr[1].sz = 60;
  ptr[1].p = &sec0[0];
  
  tmp.theFacade->lock_mutex();
  tmp.theRegistry->prepareSend(&signal, 1, theData, processId, ptr);
  tmp.theFacade->unlock_mutex();
  
  signal.set(0, CMVMI, GSN_TESTSIG, 3);
  signal.m_noOfSections = 2;
  signal.m_fragmentInfo = 3;
  
  theData[0] = 0;
  theData[1] = 1;
  theData[2] = 7; // FragmentId
  
  ptr[0].sz = 10;
  ptr[0].p = &sec0[60];

  ptr[1].sz = 123;
  ptr[1].p = &sec1[0];

  tmp.theFacade->lock_mutex();
  tmp.theRegistry->prepareSend(&signal, 1, theData, processId, ptr);
  tmp.theFacade->unlock_mutex();
}
+0 −8
Original line number Diff line number Diff line
@@ -130,7 +130,6 @@ public:
  void executeStop(int processId, const char* parameters, bool all);
  void executeStart(int processId, const char* parameters, bool all);
  void executeRestart(int processId, const char* parameters, bool all);
  void executeLogLevel(int processId, const char* parameters, bool all);
  void executeError(int processId, const char* parameters, bool all);
  void executeTrace(int processId, const char* parameters, bool all);
  void executeLog(int processId, const char* parameters, bool all);
@@ -140,14 +139,7 @@ public:
  void executeTestOn(int processId, const char* parameters, bool all);
  void executeTestOff(int processId, const char* parameters, bool all);
  void executeStatus(int processId, const char* parameters, bool all);
  void executeEnterSingleUser(char* parameters);
  void executeExitSingleUser(char* parameters);
  void executeEventReporting(int processId, const char* parameters, bool all);
  void executeDumpState(int processId, const char* parameters, bool all);
  void executeStartBackup(char * pars);
  void executeAbortBackup(char * pars);

  void jonas(int processId, const char* parameters, bool all);  

  /**
   * A execute function definition
+13 −24
Original line number Diff line number Diff line
@@ -65,37 +65,25 @@ NdbConnection* Ndb::doConnect(Uint32 tConNode)
// We will connect to any node. Make sure that we have connections to all
// nodes.
//****************************************************************************
  Uint32 tNoOfDbNodes = theNoOfDBnodes;
  i = theCurrentConnectIndex;
  Uint32 tNoOfDbNodes= theImpl->theNoOfDBnodes;
  Uint32 &theCurrentConnectIndex= theImpl->theCurrentConnectIndex;
  UintR Tcount = 0;
  do {
    if (i >= tNoOfDbNodes) {
      i = 0;
    theCurrentConnectIndex++;
    if (theCurrentConnectIndex >= tNoOfDbNodes) {
      theCurrentConnectIndex = 0;
    }//if
    Tcount++;
    tNode = theDBnodes[i];
    tNode = theImpl->theDBnodes[theCurrentConnectIndex];
    TretCode = NDB_connect(tNode);
    if ((TretCode == 1) || (TretCode == 2)) {
//****************************************************************************
// We have connections now to the desired node. Return
//****************************************************************************
      if (theCurrentConnectIndex == i) {
        theCurrentConnectCounter++;
        if (theCurrentConnectCounter == 8) {
	  theCurrentConnectCounter = 1;
	  theCurrentConnectIndex++;
	}//if
      } else {
	// Set to 2 because we have already connected to a node 
	// when we get here.
        theCurrentConnectCounter = 2;
        theCurrentConnectIndex = i;
      }//if
      return getConnectedNdbConnection(tNode);
    } else if (TretCode != 0) {
      tAnyAlive = 1;
    }//if
    i++;
  } while (Tcount < tNoOfDbNodes);
//****************************************************************************
// We were unable to find a free connection. If no node alive we will report
@@ -211,8 +199,9 @@ Ndb::doDisconnect()
  NdbConnection* tNdbCon;
  CHECK_STATUS_MACRO_VOID;

  DBUG_PRINT("info", ("theNoOfDBnodes=%d", theNoOfDBnodes));
  Uint32 tNoOfDbNodes = theNoOfDBnodes;
  Uint32 tNoOfDbNodes = theImpl->theNoOfDBnodes;
  Uint8 *theDBnodes= theImpl->theDBnodes;
  DBUG_PRINT("info", ("theNoOfDBnodes=%d", tNoOfDbNodes));
  UintR i;
  for (i = 0; i < tNoOfDbNodes; i++) {
    Uint32 tNode = theDBnodes[i];
@@ -259,8 +248,8 @@ Ndb::waitUntilReady(int timeout)
      unsigned int foundAliveNode = 0;
      TransporterFacade *tp = TransporterFacade::instance();
      tp->lock_mutex();
      for (unsigned int i = 0; i < theNoOfDBnodes; i++) {
	const NodeId nodeId = theDBnodes[i];
      for (unsigned int i = 0; i < theImpl->theNoOfDBnodes; i++) {
	const NodeId nodeId = theImpl->theDBnodes[i];
	//************************************************
	// If any node is answering, ndb is answering
	//************************************************
@@ -270,7 +259,7 @@ Ndb::waitUntilReady(int timeout)
      }//for
      
      tp->unlock_mutex();
      if (foundAliveNode == theNoOfDBnodes) {
      if (foundAliveNode == theImpl->theNoOfDBnodes) {
	DBUG_RETURN(0);
      }//if
      if (foundAliveNode > 0) {
@@ -1077,7 +1066,7 @@ Ndb::guessPrimaryNode(Uint32 fragmentId){

void
Ndb::StartTransactionNodeSelectionData::init(Uint32 noOfNodes,
                                             Uint32 nodeIds[]) {
                                             Uint8 nodeIds[]) {
  kValue           = 6;
  noOfFragments    = 2 * noOfNodes;

Loading