Commit 4a584b17 authored by unknown's avatar unknown
Browse files

added --core-file option to ndb executables

added parseable printout in ndb_restore

parent 354fa102
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -30,8 +30,14 @@ my_bool opt_ndb_optimized_node_selection

bool opt_endinfo= 0;
my_bool opt_ndb_shm;
my_bool opt_core;

#define OPT_NDB_CONNECTSTRING 'c'
#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
#define OPT_WANT_CORE_DEFAULT 1
#else
#define OPT_WANT_CORE_DEFAULT 0
#endif

#define NDB_STD_OPTS_COMMON \
  { "usage", '?', "Display this help and exit.", \
@@ -57,7 +63,10 @@ my_bool opt_ndb_shm;
    GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\
  { "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\
    (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,\
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
  { "core-file", OPT_WANT_CORE, "Write core on errors.",\
    (gptr*) &opt_core, (gptr*) &opt_core, 0,\
    GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0}

#ifndef DBUG_OFF
#define NDB_STD_OPTS(prog_name) \
@@ -80,6 +89,7 @@ enum ndb_std_options {
  OPT_NDB_SHM= 256,
  OPT_NDB_SHM_SIGNUM,
  OPT_NDB_OPTIMIZED_NODE_SELECTION,
  OPT_WANT_CORE,
  NDB_STD_OPTIONS_LAST /* should always be last in this enum */
};

+23 −17
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ extern "C" {
  extern void (* ndb_new_handler)();
}
extern EventLogger g_eventLogger;
extern my_bool opt_core;

/**
 * Declare the global variables 
@@ -168,23 +169,25 @@ NdbShutdown(NdbShutdownType type,
    }
    
    const char * exitAbort = 0;
#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
    if (opt_core)
      exitAbort = "aborting";
#else
    else
      exitAbort = "exiting";
#endif
    
    if(type == NST_Watchdog){
      /**
       * Very serious, don't attempt to free, just die!!
       */
      g_eventLogger.info("Watchdog shutdown completed - %s", exitAbort);
#if defined VM_TRACE && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
      if (opt_core)
      {
	signal(6, SIG_DFL);
	abort();
#else
      }
      else
      {
	exit(-1);
#endif
      }
    }

#ifndef NDB_WIN32
@@ -236,12 +239,15 @@ NdbShutdown(NdbShutdownType type,
      if (type == NST_ErrorHandlerStartup)
	kill(getppid(), SIGUSR1);
      g_eventLogger.info("Error handler shutdown completed - %s", exitAbort);
#if ( defined VM_TRACE || defined ERROR_INSERT ) && ( ! ( defined NDB_OSE || defined NDB_SOFTOSE) )
      if (opt_core)
      {
	signal(6, SIG_DFL);
	abort();
#else
      }
      else
      {
	exit(-1);
#endif
      }
    }
    
    /**
+8 −8
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <m_string.h>

extern my_bool opt_ndb_shm;
extern my_bool opt_core;

#define MAX_LINE_LENGTH 255
#define KEY_INTERNAL 0
@@ -2140,11 +2141,10 @@ static void require(bool v)
{
  if(!v)
  {
#ifndef DBUG_OFF
    if (opt_core)
      abort();
#else
    else
      exit(-1);
#endif
  }
}

@@ -2214,7 +2214,7 @@ ConfigInfo::ConfigInfo()
      ndbout << "Error: Parameter " << param._fname
	     << " defined twice in section " << param._section
	     << "." << endl;
      exit(-1);
      require(false);
    }
    
    // Add new pinfo to section
@@ -2264,7 +2264,7 @@ ConfigInfo::ConfigInfo()
      ndbout << "Check that each entry has a section failed." << endl;
      ndbout << "Parameter \"" << m_ParamInfo[i]._fname << endl; 
      ndbout << "Edit file " << __FILE__ << "." << endl;
      exit(-1);
      require(false);
    }
    
    if(m_ParamInfo[i]._type == ConfigInfo::CI_SECTION)
@@ -2277,7 +2277,7 @@ ConfigInfo::ConfigInfo()
	     << "\" does not exist in section \"" 
	     << m_ParamInfo[i]._section << "\"." << endl;
      ndbout << "Edit file " << __FILE__ << "." << endl;
      exit(-1);
      require(false);
    }
  }
}
+23 −11
Original line number Diff line number Diff line
@@ -65,6 +65,18 @@

extern int global_flag_send_heartbeat_now;
extern int g_no_nodeid_checks;
extern my_bool opt_core;

static void require(bool v)
{
  if(!v)
  {
    if (opt_core)
      abort();
    else
      exit(-1);
  }
}

void *
MgmtSrvr::logLevelThread_C(void* m)
@@ -436,14 +448,14 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
    if (tmp_nodeid == 0)
    {
      ndbout_c(m_config_retriever->getErrorString());
      exit(-1);
      require(false);
    }
    // read config from other managent server
    _config= fetchConfig();
    if (_config == 0)
    {
      ndbout << m_config_retriever->getErrorString() << endl;
      exit(-1);
      require(false);
    }
    _ownNodeId= tmp_nodeid;
  }
@@ -454,7 +466,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
    _config= readConfig();
    if (_config == 0) {
      ndbout << "Unable to read config file" << endl;
      exit(-1);
      require(false);
    }
  }

@@ -511,7 +523,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
  if ((m_node_id_mutex = NdbMutex_Create()) == 0)
  {
    ndbout << "mutex creation failed line = " << __LINE__ << endl;
    exit(-1);
    require(false);
  }

  if (_ownNodeId == 0) // we did not get node id from other server
@@ -522,7 +534,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
		       0, 0, error_string)){
      ndbout << "Unable to obtain requested nodeid: "
	     << error_string.c_str() << endl;
      exit(-1);
      require(false);
    }
    _ownNodeId = tmp;
  }
@@ -533,7 +545,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_server,
					  _ownNodeId))
    {
      ndbout << m_config_retriever->getErrorString() << endl;
      exit(-1);
      require(false);
    }
  }

@@ -2203,18 +2215,18 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
    iter(*(ndb_mgm_configuration *)_config->m_configValues, CFG_SECTION_NODE);
  for(iter.first(); iter.valid(); iter.next()) {
    unsigned tmp= 0;
    if(iter.get(CFG_NODE_ID, &tmp)) abort();
    if(iter.get(CFG_NODE_ID, &tmp)) require(false);
    if (*nodeId && *nodeId != tmp)
      continue;
    found_matching_id= true;
    if(iter.get(CFG_TYPE_OF_SECTION, &type_c)) abort();
    if(iter.get(CFG_TYPE_OF_SECTION, &type_c)) require(false);
    if(type_c != (unsigned)type)
      continue;
    found_matching_type= true;
    if (connected_nodes.get(tmp))
      continue;
    found_free_node= true;
    if(iter.get(CFG_NODE_HOST, &config_hostname)) abort();
    if(iter.get(CFG_NODE_HOST, &config_hostname)) require(false);
    if (config_hostname && config_hostname[0] == 0)
      config_hostname= 0;
    else if (client_addr) {
@@ -2561,7 +2573,7 @@ MgmtSrvr::backupCallback(BackupEvent & event)
int
MgmtSrvr::repCommand(Uint32* repReqId, Uint32 request, bool waitCompleted)
{
  abort();
  require(false);
  return 0;
}

@@ -2715,7 +2727,7 @@ MgmtSrvr::setDbParameter(int node, int param, const char * value,
      ndbout_c("Updating node %d param: %d to %s",  node, param, val_char);
      break;
    default:
      abort();
      require(false);
    }
    assert(res);
  } while(node == 0 && iter.next() == 0);
+0 −2
Original line number Diff line number Diff line
@@ -343,8 +343,6 @@ MgmApiSession::getConfig_old(Parser_t::Context &ctx) {
}
#endif /* MGM_GET_CONFIG_BACKWARDS_COMPAT */

inline void require(bool b){ if(!b) abort(); }

void
MgmApiSession::getConfig(Parser_t::Context &ctx, 
			 const class Properties &args) {
Loading