Repository: trafficserver
Updated Branches:
  refs/heads/master 4ecfe2ddf -> a2d3a52a6


TS-645: remove calls in which hard restart is used

It's hard to tell what this is useful for when you have upstart,
systemd, SMF and others controling.  Aside from being implemented
poorly via system(3), it's an API breakage, which is why we're
putting it into 5.0.x


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/51b979e9
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/51b979e9
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/51b979e9

Branch: refs/heads/master
Commit: 51b979e9afa89a64d1adea63508ab4f654f804f5
Parents: 4ecfe2d
Author: Igor Galić <[email protected]>
Authored: Mon Jan 20 23:05:26 2014 +0100
Committer: James Peach <[email protected]>
Committed: Wed Apr 23 10:00:59 2014 -0700

----------------------------------------------------------------------
 cmd/traffic_shell/CliCreateCommands.cc |  3 --
 cmd/traffic_shell/CliMgmtUtils.cc      |  3 +-
 cmd/traffic_shell/ConfigCmd.cc         | 39 -----------------
 cmd/traffic_shell/ConfigCmd.h          |  2 -
 mgmt/api/APITestCliRemote.cc           | 17 --------
 mgmt/api/CoreAPI.cc                    | 16 -------
 mgmt/api/CoreAPI.h                     |  1 -
 mgmt/api/CoreAPIRemote.cc              | 65 -----------------------------
 mgmt/api/INKMgmtAPI.cc                 | 17 +-------
 mgmt/api/INKMgmtAPIStub.cc             |  6 ---
 mgmt/api/include/mgmtapi.h             |  7 ----
 11 files changed, 2 insertions(+), 174 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/cmd/traffic_shell/CliCreateCommands.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_shell/CliCreateCommands.cc 
b/cmd/traffic_shell/CliCreateCommands.cc
index 5a22207..2777301 100644
--- a/cmd/traffic_shell/CliCreateCommands.cc
+++ b/cmd/traffic_shell/CliCreateCommands.cc
@@ -133,9 +133,6 @@ CliCreateCommands()
 
   createCommand("config:stop", Cmd_ConfigStop, NULL, CLI_COMMAND_EXTERNAL, 
"config:stop", "Stop proxy software");
 
-  createCommand("config:hard-restart", Cmd_ConfigHardRestart, NULL, 
CLI_COMMAND_EXTERNAL,
-                "config:hard-restart", "Perform Hard Restart of all software 
components");
-
   createCommand("config:restart", Cmd_ConfigRestart, CmdArgs_ConfigRestart, 
CLI_COMMAND_EXTERNAL,
                 "config:restart [cluster]", "Perform Restart of proxy 
software");
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/cmd/traffic_shell/CliMgmtUtils.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_shell/CliMgmtUtils.cc 
b/cmd/traffic_shell/CliMgmtUtils.cc
index 72c2ee8..67666cd 100644
--- a/cmd/traffic_shell/CliMgmtUtils.cc
+++ b/cmd/traffic_shell/CliMgmtUtils.cc
@@ -273,8 +273,7 @@ Cli_ConfigEnactChanges(TSActionNeedT action_need)
   case TS_ACTION_SHUTDOWN:
     Cli_Debug("Cli_ConfigEnactChanges: TS_ACTION_SHUTDOWN\n");
     Cli_Printf("\nHard Restart required.\n"
-               "  Change will take effect after next Hard Restart.\n"
-               "  Use the \"config:hard-restart\" command to restart 
now.\n\n");
+               "  Change will take effect after next Hard Restart.\n");
     break;
 
   case TS_ACTION_RESTART:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/cmd/traffic_shell/ConfigCmd.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_shell/ConfigCmd.cc b/cmd/traffic_shell/ConfigCmd.cc
index a40da20..ee17181 100644
--- a/cmd/traffic_shell/ConfigCmd.cc
+++ b/cmd/traffic_shell/ConfigCmd.cc
@@ -459,45 +459,6 @@ Cmd_ConfigStop(ClientData clientData, Tcl_Interp * interp, 
int argc, const char
 }
 
 ////////////////////////////////////////////////////////////////
-// Cmd_ConfigHardRestart
-//
-// This is the callback function for the "config:hard-restart" command.
-//
-// Parameters:
-//    clientData -- information about parsed arguments
-//    interp -- the Tcl interpreter
-//    argc -- number of command arguments
-//    argv -- the command arguments
-//
-int
-Cmd_ConfigHardRestart(ClientData clientData, Tcl_Interp * interp, int argc, 
const char *argv[])
-{
-  /* call to processArgForCommand must appear at the beginning
-   * of each command's callback function
-   */
-  if (processArgForCommand(interp, argc, argv) != CLI_OK) {
-    return CMD_ERROR;
-  }
-
-  if (processHelpCommand(argc, argv) == CLI_OK)
-    return CMD_OK;
-  if (cliCheckIfEnabled("config:hard-restart") == CLI_ERROR) {
-    return CMD_ERROR;
-  }
-
-  cli_cmdCallbackInfo *cmdCallbackInfo;
-
-  cmdCallbackInfo = (cli_cmdCallbackInfo *) clientData;
-  Cli_Debug("Cmd_ConfigHardRestart argc %d\n", argc);
-
-  if (argc == 1) {
-    return (TSHardRestart());
-  }
-  Cli_Error(ERR_COMMAND_SYNTAX, cmdCallbackInfo->command_usage);
-  return CMD_ERROR;
-}
-
-////////////////////////////////////////////////////////////////
 // Cmd_ConfigRestart
 //
 // This is the callback function for the "config:restart" command.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/cmd/traffic_shell/ConfigCmd.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_shell/ConfigCmd.h b/cmd/traffic_shell/ConfigCmd.h
index 42ed681..520d5f4 100644
--- a/cmd/traffic_shell/ConfigCmd.h
+++ b/cmd/traffic_shell/ConfigCmd.h
@@ -354,8 +354,6 @@ int Cmd_ConfigStart(ClientData clientData, Tcl_Interp * 
interp, int argc, const
 //
 int Cmd_ConfigStop(ClientData clientData, Tcl_Interp * interp, int argc, const 
char *argv[]);
 
-int Cmd_ConfigHardRestart(ClientData clientData, Tcl_Interp * interp, int 
argc, const char *argv[]);
-
 int Cmd_ConfigRestart(ClientData clientData, Tcl_Interp * interp, int argc, 
const char *argv[]);
 int CmdArgs_ConfigRestart();
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/mgmt/api/APITestCliRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/APITestCliRemote.cc b/mgmt/api/APITestCliRemote.cc
index 57f6ebc..0b1318e 100644
--- a/mgmt/api/APITestCliRemote.cc
+++ b/mgmt/api/APITestCliRemote.cc
@@ -39,7 +39,6 @@
  *                 eg. start, start:hostdb, start:all
  * stop:    turns Proxy off
  * restart: restarts Traffic Manager (Traffic Cop must be running)
- * kill_TC: restarts Traffic Cop (and TM and TS too)
  *
  * File operations:
  * ---------------
@@ -937,20 +936,6 @@ reconfigure()
   print_err("reconfigure", ret);
 }
 
-// currently does nothing
-void
-hard_restart()
-{
-  TSError ret;
-
-  printf("[hard_restart]Restart Traffic Cop\n");
-  if ((ret = TSHardRestart()) != TS_ERR_OKAY)
-    printf("[TSHardRestart] FAILED\n");
-
-  print_err("hard_restart", ret);
-}
-
-
 /* ------------------------------------------------------------------------
  * test_action_need
  * ------------------------------------------------------------------------
@@ -2369,8 +2354,6 @@ runInteractive()
       restart();
     } else if (strstr(buf, "reconfig")) {
       reconfigure();
-    } else if (strstr(buf, "kill_TC")) {
-      hard_restart();
     } else if (strstr(buf, "records")) {
       test_records();
     } else if (strstr(buf, "err_recs")) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/mgmt/api/CoreAPI.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc
index 592d782..813a2fd 100644
--- a/mgmt/api/CoreAPI.cc
+++ b/mgmt/api/CoreAPI.cc
@@ -262,19 +262,6 @@ Restart(bool cluster)
 }
 
 /*-------------------------------------------------------------------------
- * HardRestart
- *-------------------------------------------------------------------------
- * Cannot be executed locally since it requires a restart of Traffic Cop.
- * So just return TS_ERR_FAIL. Should only be called by remote API clients.
- */
-TSError
-HardRestart()
-{
-  return TS_ERR_FAIL;
-}
-
-
-/*-------------------------------------------------------------------------
  * Bouncer
  *-------------------------------------------------------------------------
  * Bounces traffic_server process(es).
@@ -419,9 +406,6 @@ determine_action_need(const char *rec_name)
   case RECU_RESTART_TM:          // requires TM/TS restart
     return TS_ACTION_RESTART;
 
-  case RECU_RESTART_TC:          // requires TC/TM/TS restart
-    return TS_ACTION_SHUTDOWN;
-
   default:                     // shouldn't get here actually
     return TS_ACTION_UNDEFINED;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/mgmt/api/CoreAPI.h
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPI.h b/mgmt/api/CoreAPI.h
index 21d9da6..a260416 100644
--- a/mgmt/api/CoreAPI.h
+++ b/mgmt/api/CoreAPI.h
@@ -53,7 +53,6 @@ TSError ProxyStateSet(TSProxyStateT state, TSCacheClearT 
clear);
 
 TSError Reconfigure();         // TS reread config files
 TSError Restart(bool cluster); //restart TM
-TSError HardRestart();         //restart traffic_cop
 TSError Bounce(bool cluster);  //restart traffic_server
 TSError StorageDeviceCmdOffline(char const* dev); // Storage device operation.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/mgmt/api/CoreAPIRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc
index c15979e..a3ae85b 100644
--- a/mgmt/api/CoreAPIRemote.cc
+++ b/mgmt/api/CoreAPIRemote.cc
@@ -60,7 +60,6 @@ TSError send_and_parse_basic(OpType op);
 TSError send_and_parse_list(OpType op, LLQ * list);
 TSError send_and_parse_name(OpType op, char *name);
 TSError mgmt_record_set(const char *rec_name, const char *rec_val, 
TSActionNeedT * action_need);
-bool start_binary(const char *abs_bin_path);
 
 // global variables
 // need to store the thread id associated with socket_test_thread
@@ -193,39 +192,6 @@ mgmt_record_set(const char *rec_name, const char *rec_val, 
TSActionNeedT * actio
 }
 
 
-/*-------------------------------------------------------------------------
- * start_binary
- *-------------------------------------------------------------------------
- * helper function which calls the executable specified by abs_bin_path;
- * used by HardRestart to call the stop/start_traffic_server scripts
- * Output: returns false if fail, true if successful
- */
-bool
-start_binary(const char *abs_bin_path)
-{
-  TSDiags(TS_DIAG_NOTE, "[start_binary] abs_bin_path = %s", abs_bin_path);
-  // before doing anything, check for existence of binary and its execute
-  // permissions
-  if (access(abs_bin_path, F_OK) < 0) {
-    // ERROR: can't find binary
-    TSDiags(TS_DIAG_ERROR, "Cannot find executable %s", abs_bin_path);
-    return false;
-  }
-  // binary exists, check permissions
-  else if (access(abs_bin_path, R_OK | X_OK) < 0) {
-    // ERROR: doesn't have proper permissions
-    TSDiags(TS_DIAG_ERROR, "Cannot execute %s", abs_bin_path);
-    return false;
-  }
-
-  if (system(abs_bin_path) == -1) {
-    TSDiags(TS_DIAG_ERROR, "Cannot system(%s)", abs_bin_path);
-    return false;
-  }
-
-  return true;
-}
-
 
 /***************************************************************************
  * SetUp Operations
@@ -416,37 +382,6 @@ Restart(bool cluster)
 
 
 /*-------------------------------------------------------------------------
- * HardRestart
- *-------------------------------------------------------------------------
- * Restarts Traffic Cop by using the stop_traffic_server, start_traffic_server 
script
- */
-TSError
-HardRestart()
-{
-  char start_path[1024];
-  char stop_path[1024];
-
-  if (!Layout::get() || !Layout::get()->bindir)
-    return TS_ERR_FAIL;
-  // determine the path of where start and stop TS scripts stored
-  TSDiags(TS_DIAG_NOTE, "Root Directory: %s", Layout::get()->bindir);
-
-  Layout::relative_to(start_path, sizeof(start_path), Layout::get()->bindir, 
"start_traffic_server");
-  Layout::relative_to(stop_path, sizeof(stop_path), Layout::get()->bindir, 
"stop_traffic_server");
-
-  TSDiags(TS_DIAG_NOTE, "[HardRestart] start_path = %s", start_path);
-  TSDiags(TS_DIAG_NOTE, "[HardRestart] stop_path = %s", stop_path);
-
-  if (!start_binary(stop_path)) // call stop_traffic_server script
-    return TS_ERR_FAIL;
-
-  if (!start_binary(start_path))        // call start_traffic_server script
-    return TS_ERR_FAIL;
-
-  return TS_ERR_OKAY;
-}
-
-/*-------------------------------------------------------------------------
  * Bounce
  *-------------------------------------------------------------------------
  * Restart the traffic_server process(es) only.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/mgmt/api/INKMgmtAPI.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/INKMgmtAPI.cc b/mgmt/api/INKMgmtAPI.cc
index a466fbd..bdd7e2d 100644
--- a/mgmt/api/INKMgmtAPI.cc
+++ b/mgmt/api/INKMgmtAPI.cc
@@ -1776,19 +1776,6 @@ TSRestart(bool cluster)
   return Restart(cluster);
 }
 
-/* TSHardRestart: a traffic_cop restart (restarts TM and TS),
- * essentially does a "start_traffic_server"/"stop_traffic_server" sequence
- * Input:  <none>
- * Output: TSError
- * Note: only for remote API clients
- */
-/* CAN ONLY BE IMPLEMENTED ON THE REMOTE SIDE !!! */
-tsapi TSError
-TSHardRestart()
-{
-  return HardRestart();         // should return TS_ERR_FAIL
-}
-
 /* TSActionDo: based on TSActionNeedT, will take appropriate action
  * Input: action - action that needs to be taken
  * Output: TSError
@@ -1799,9 +1786,6 @@ TSActionDo(TSActionNeedT action)
   TSError ret;
 
   switch (action) {
-  case TS_ACTION_SHUTDOWN:
-    ret = HardRestart();
-    break;
   case TS_ACTION_RESTART:
     ret = Restart(true);        // cluster wide by default?
     break;
@@ -1811,6 +1795,7 @@ TSActionDo(TSActionNeedT action)
   case TS_ACTION_DYNAMIC:
     /* do nothing - change takes effect immediately */
     return TS_ERR_OKAY;
+  case TS_ACTION_SHUTDOWN:
   default:
     return TS_ERR_FAIL;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/mgmt/api/INKMgmtAPIStub.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/INKMgmtAPIStub.cc b/mgmt/api/INKMgmtAPIStub.cc
index adbbaf9..36219cd 100644
--- a/mgmt/api/INKMgmtAPIStub.cc
+++ b/mgmt/api/INKMgmtAPIStub.cc
@@ -541,12 +541,6 @@ INKRestart(bool cluster)
 }
 
 inkapi INKError
-INKHardRestart()
-{
-  return INK_ERR_OKAY;
-}
-
-inkapi INKError
 INKActionDo(INKActionNeedT action)
 {
   return INK_ERR_OKAY;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51b979e9/mgmt/api/include/mgmtapi.h
----------------------------------------------------------------------
diff --git a/mgmt/api/include/mgmtapi.h b/mgmt/api/include/mgmtapi.h
index ef6338b..2bdd01f 100644
--- a/mgmt/api/include/mgmtapi.h
+++ b/mgmt/api/include/mgmtapi.h
@@ -1007,13 +1007,6 @@ extern "C"
  */
   tsapi TSError TSRestart(bool cluster);
 
-/* TSHardRestart: stops and then starts Traffic Server
- * Input:  <none>
- * Output: TSError
- * Note: only for remote API clients
- */
-  tsapi TSError TSHardRestart();
-
 /* TSActionDo: based on TSActionNeedT, will take appropriate action
  * Input: action - action that needs to be taken
  * Output: TSError

Reply via email to