Repository: trafficserver Updated Branches: refs/heads/master 60914fa2e -> b43372034
TS-3140: remove the traffic_ctl bounce command The distinction between restart and bounce is hard to remember. Rather that two separate traffic_ctl subcommands, let's make this a single subcommand with the option to also restart traffic_manager. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b4337203 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b4337203 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b4337203 Branch: refs/heads/master Commit: b433720349d1817561e22cbc9deedbbb6adcfe19 Parents: 60914fa Author: James Peach <[email protected]> Authored: Wed Feb 25 09:13:40 2015 -0800 Committer: James Peach <[email protected]> Committed: Wed Feb 25 15:46:50 2015 -0800 ---------------------------------------------------------------------- CHANGES | 2 ++ cmd/traffic_ctl/server.cc | 50 +++++++++--------------------------------- 2 files changed, 12 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4337203/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index a64140f..bce291e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 5.3.0 + *) [TS-3140] Remove the traffic_ctl "bounce" command. + *) [TS-3404] Handle race condition in handling delayed terminating chunk *) [TS-3406] Change TS_NPN_PROTOCOL_HTTP_2_0 to "h2". http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4337203/cmd/traffic_ctl/server.cc ---------------------------------------------------------------------- diff --git a/cmd/traffic_ctl/server.cc b/cmd/traffic_ctl/server.cc index 3b0e387..abb6e64 100644 --- a/cmd/traffic_ctl/server.cc +++ b/cmd/traffic_ctl/server.cc @@ -24,35 +24,14 @@ #include "traffic_ctl.h" static int drain = 0; +static int manager = 0; const ArgumentDescription opts[] = { { "drain", '-', "Wait for client connections to drain before restarting", "F", &drain, NULL, NULL }, + { "manager", '-', "Restart traffic_manager as well as traffic_server", "F", &manager, NULL, NULL }, }; static int -bounce(unsigned argc, const char ** argv, unsigned flags) -{ - TSMgmtError error; - const char * usage = (flags & TS_RESTART_OPT_CLUSTER) ? "cluster bounce [OPTIONS]" : "server bounce [OPTIONS]"; - - if (!CtrlProcessArguments(argc, argv, opts, countof(opts)) || n_file_arguments != 0) { - return CtrlCommandUsage(usage, opts, countof(opts)); - } - - if (drain) { - flags |= TS_RESTART_OPT_DRAIN; - } - - error = TSBounce(flags); - if (error != TS_ERR_OKAY) { - CtrlMgmtError(error, "%s bounce failed", (flags & TS_RESTART_OPT_CLUSTER) ? "cluster" : "server"); - return CTRL_EX_ERROR; - } - - return CTRL_EX_OK; -} - -static int restart(unsigned argc, const char ** argv, unsigned flags) { TSMgmtError error; @@ -66,7 +45,12 @@ restart(unsigned argc, const char ** argv, unsigned flags) flags |= TS_RESTART_OPT_DRAIN; } - error = TSRestart(flags); + if (manager) { + error = TSRestart(flags); + } else { + error = TSBounce(flags); + } + if (error != TS_ERR_OKAY) { CtrlMgmtError(error, "%s restart failed", (flags & TS_RESTART_OPT_CLUSTER) ? "cluster" : "server"); return CTRL_EX_ERROR; @@ -76,18 +60,6 @@ restart(unsigned argc, const char ** argv, unsigned flags) } static int -cluster_bounce(unsigned argc, const char ** argv) -{ - return bounce(argc, argv, TS_RESTART_OPT_CLUSTER); -} - -static int -server_bounce(unsigned argc, const char ** argv) -{ - return bounce(argc, argv, TS_RESTART_OPT_NONE); -} - -static int cluster_restart(unsigned argc, const char ** argv) { return restart(argc, argv, TS_RESTART_OPT_CLUSTER); @@ -149,8 +121,7 @@ subcommand_cluster(unsigned argc, const char ** argv) { const subcommand commands[] = { - { cluster_bounce, "bounce", "Restart traffic_server across the cluster" }, - { cluster_restart, "restart", "Restart traffic_server and traffic_server across the cluster" }, + { cluster_restart, "restart", "Restart the Traffic Server cluster" }, { CtrlUnimplementedCommand, "status", "Show the cluster status" }, }; @@ -162,8 +133,7 @@ subcommand_server(unsigned argc, const char ** argv) { const subcommand commands[] = { - { server_bounce, "bounce", "Restart traffic_server" }, - { server_restart, "restart", "Restart traffic_server and traffic_server" }, + { server_restart, "restart", "Restart Traffic Server" }, { server_backtrace, "backtrace", "Show a full stack trace of the traffic_server process" }, { server_status, "status", "Show the proxy status" },
