Commit e9df5390 authored by unknown's avatar unknown
Browse files

ndb - autotest

  Add shutdown options (so far only SIGKILL), so that there won't be any strace mysqld threads


ndb/src/cw/cpcd/APIService.cpp:
  Add shutdown options
   (so far only SIGKILL)
ndb/src/cw/cpcd/CPCD.hpp:
  Add shutdown options
   (so far only SIGKILL)
ndb/src/cw/cpcd/Process.cpp:
  Add shutdown options
   (so far only SIGKILL)
ndb/test/include/CpcClient.hpp:
  Add shutdown options
   (so far only SIGKILL)
ndb/test/run-test/main.cpp:
  Add shutdown options
   (so far only SIGKILL)
ndb/test/src/CpcClient.cpp:
  Add shutdown options
   (so far only SIGKILL)
parent 5cf0deb2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ ParserRow<CPCDAPISession> commands[] =
    CPCD_ARG("stderr", String, Optional,  "Redirection of stderr"),
    CPCD_ARG("stdin",  String, Optional,  "Redirection of stderr"),
    CPCD_ARG("ulimit", String, Optional,  "ulimit"),
    CPCD_ARG("shutdown", String, Optional,  "shutdown options"),  

  CPCD_CMD("undefine process", &CPCDAPISession::undefineProcess, ""),
    CPCD_CMD_ALIAS("undef", "undefine process", 0),
+6 −0
Original line number Diff line number Diff line
@@ -243,6 +243,12 @@ public:
     * @desc Format c:unlimited d:0 ...
     */
    BaseString m_ulimit;

    /**
     * @brief shutdown options
     */
    BaseString m_shutdown_options;

  private:
    class CPCD *m_cpcd;
    void do_exec();
+8 −1
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ CPCD::Process::print(FILE * f){
  fprintf(f, "stdout: %s\n", m_stdout.c_str() ? m_stdout.c_str() : "");
  fprintf(f, "stderr: %s\n", m_stderr.c_str() ? m_stderr.c_str() : "");
  fprintf(f, "ulimit: %s\n", m_ulimit.c_str() ? m_ulimit.c_str() : "");
  fprintf(f, "shutdown: %s\n", m_shutdown_options.c_str() ? 
	  m_shutdown_options.c_str() : "");
}

CPCD::Process::Process(const Properties & props, class CPCD *cpcd) {
@@ -64,6 +66,7 @@ CPCD::Process::Process(const Properties & props, class CPCD *cpcd) {
  props.get("stdout", m_stdout);
  props.get("stderr", m_stderr);
  props.get("ulimit", m_ulimit);
  props.get("shutdown", m_shutdown_options);
  m_status = STOPPED;

  if(strcasecmp(m_type.c_str(), "temporary") == 0){
@@ -451,7 +454,11 @@ CPCD::Process::stop() {
  m_status = STOPPING;
  
  errno = 0;
  int ret = kill(-m_pid, SIGTERM);
  int signo= SIGTERM;
  if(m_shutdown_options == "SIGKILL")
    signo= SIGKILL;

  int ret = kill(-m_pid, signo);
  switch(ret) {
  case 0:
    logger.debug("Sent SIGTERM to pid %d", (int)-m_pid);
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ public:
    BaseString m_stdout;
    BaseString m_stderr;
    BaseString m_ulimit;
    BaseString m_shutdown_options;
  };

private:
+2 −0
Original line number Diff line number Diff line
@@ -448,6 +448,7 @@ setup_config(atrt_config& config){
      proc.m_proc.m_runas = proc.m_host->m_user;
      proc.m_proc.m_ulimit = "c:unlimited";
      proc.m_proc.m_env.assfmt("MYSQL_BASE_DIR=%s", dir.c_str());
      proc.m_proc.m_shutdown_options = "";
      proc.m_hostname = proc.m_host->m_hostname;
      proc.m_ndb_mgm_port = g_default_base_port;
      if(split1[0] == "mgm"){
@@ -470,6 +471,7 @@ setup_config(atrt_config& config){
	proc.m_proc.m_path.assign(dir).append("/libexec/mysqld");
	proc.m_proc.m_args = "--core-file --ndbcluster";
	proc.m_proc.m_cwd.appfmt("%d.mysqld", index);
	proc.m_proc.m_shutdown_options = "SIGKILL"; // not nice
      } else if(split1[0] == "api"){
	proc.m_type = atrt_process::NDB_API;
	proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_api");
Loading