trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] branch 8.0.x updated: Revert "add a reason tag to traffic_control host subcommand."
Date Thu, 16 May 2019 14:59:25 GMT
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.0.x by this push:
     new 3f98f43  Revert "add a reason tag to traffic_control host subcommand."
3f98f43 is described below

commit 3f98f43b42c8f47c1a85aa864d5d9bd20aa7c6d8
Author: Leif Hedstrom <leif@ogre.com>
AuthorDate: Thu May 16 08:57:33 2019 -0600

    Revert "add a reason tag to traffic_control host subcommand."
    
    This reverts commit ed0cd7311624847529b6d1e54e58759975ebc505.
    
    No. Please never merge your PRs on release branches, this is up to the
    RMs to shepherd. In this case, this will not go into 8.0.x, rather, it
    will go into 8.1.x, as commented on the PR beore merge happened.
---
 doc/admin-guide/files/parent.config.en.rst     |   8 -
 doc/appendices/command-line/traffic_ctl.en.rst |  48 +--
 iocore/net/I_NetProcessor.h                    |   2 -
 iocore/net/P_UnixNetProcessor.h                |   1 -
 iocore/net/UnixNetProcessor.cc                 |  21 +-
 mgmt/LocalManager.cc                           |   4 +-
 mgmt/LocalManager.h                            |   2 +-
 mgmt/api/CoreAPI.cc                            |  11 +-
 mgmt/api/CoreAPI.h                             |   4 +-
 mgmt/api/CoreAPIRemote.cc                      |  12 +-
 mgmt/api/INKMgmtAPI.cc                         |   8 +-
 mgmt/api/NetworkMessage.cc                     |   4 +-
 mgmt/api/TSControlMain.cc                      |  13 +-
 mgmt/api/include/mgmtapi.h                     |   4 +-
 proxy/HostStatus.h                             | 157 +--------
 proxy/ParentSelection.cc                       | 149 +++------
 proxy/ParentSelection.h                        |   1 -
 proxy/shared/UglyLogStubs.cc                   |   6 -
 src/traffic_ctl/Makefile.inc                   |   1 -
 src/traffic_ctl/host.cc                        |  65 +---
 src/traffic_server/HostStatus.cc               | 430 +++++--------------------
 src/traffic_server/traffic_server.cc           |   2 -
 22 files changed, 187 insertions(+), 766 deletions(-)

diff --git a/doc/admin-guide/files/parent.config.en.rst b/doc/admin-guide/files/parent.config.en.rst
index ca54825..3a26e95 100644
--- a/doc/admin-guide/files/parent.config.en.rst
+++ b/doc/admin-guide/files/parent.config.en.rst
@@ -141,14 +141,6 @@ The following list shows the possible actions and their allowed values.
 
         parent="p1.x.com:8080|2.0, 192.168.0.3:80|3.0, 192.168.0.4:80|5.0"
 
-    If ``round_robin`` is set to ``consistent_hash``, you may add a ``unique hash string``
-    following the ``weight`` for each parent.  The ``hash string`` must start with ``&``
-	  and is used to build both the primary and secondary rings using the ``hash string``
-    for each parent insted of the parents ``hostname`` or ``ip address``. This can be
-    useful so that two different hosts may be used to cache the same requests.  Example::
-
-        parent="p1.x.com:80|1.0&abcdef, p2.x.com:80|1.0&xyzl, p3.x.com:80|1.0&ldffg" round_robin=consistent_hash
-
 .. _parent-config-format-secondary-parent:
 
 ``secondary_parent``
diff --git a/doc/appendices/command-line/traffic_ctl.en.rst b/doc/appendices/command-line/traffic_ctl.en.rst
index 191376a..7bc4797 100644
--- a/doc/appendices/command-line/traffic_ctl.en.rst
+++ b/doc/appendices/command-line/traffic_ctl.en.rst
@@ -258,59 +258,21 @@ traffic_ctl host
     Get the current status of the hosts used in parent.config as a next hop in a multi-tiered cache heirarchy.  The value 0 or 1 is returned indicating that the host is marked as down '0' or marked as up '1'.  If a host is marked as down, it will not be used as the next hop parent, another host marked as up will be chosen.
 
 .. program:: traffic_ctl host
-.. option:: down --time seconds --reason 'all|active|local|manual|self_detect' HOSTNAME [HOSTNAME ...]
+.. option:: down --time seconds HOSTNAME [HOSTNAME ...]
 
     Marks the listed hosts as down so that they will not be chosen as a next hop parent.
-    If the --time option is included, the host is marked down for the specified number of 
-    seconds after which the host will automatically be marked up.  0 seconds marks the host 
-    down indefinitely until marked up manually and is the default. A reason tag may be used
-    when marking a host down.  Valid values are 'manual', 'active', 'local', 'self_detect',
-    or 'all', 'manual' is used as the default.  The tags are used to indicate wether the host 
-    was marked down manually or by an 'active' or 'local' health check.  'self_detect' indicates
-    that a parent entry in parent.config was marked down because the entry refers to the
-    local host so, it is automatically marked down to prevent requests from looping. A host is
-    not marked up until all reason codes are cleared by marking up the host for the specified
-    reason code. The 'all' reason should be used very carefully as in the case of marking up,
-    it would clear the 'self_detect' reason and could result in trasaction failures due to
-    looping.  
-    
-    A stat is created for each host, with a the host fqdn and is prefixed with the string 
-    `proxy.process.host_status` with a string value.  The string value is a 
-    serialized representation of the Host status struct showing all current data ie, reasons, 
-    marked down times, and down time for each host.  The stats may be viewed using the 
-    `traffic_ctl metric` command or through the `stats_over_http` endpoint.
+    If the --time option is included, the host is marked down for the specified number of
+    seconds after which the host will automatically be marked up.  0 seconds marks the host
+    down indefinately until marked up manually and is the default.
 
 .. program:: traffic_ctl host
-.. option:: up --reason 'all|active|local|manual|self_detect' HOSTNAME [HOSTNAME ...]
+.. option:: up HOSTNAME [HOSTNAME ...]
 
     Marks the listed hosts as up so that they will be available for use as a next hop parent.
-    By default, the 'manual' reason tag is used when marking up a host.  Use the --reason
-    tag to mark the host reason code as up using one of 'manual', 'active', 'local', 'all',
-    or 'self_detect'  Be careful with the 'all' reason as it clears all reason codes including
-    'self_detect' which is used to prevent a transaction from looping.
 
 Examples
 ========
 
-Mark down a host with `traffic_ctl` and view the associated host stats::
-=======
-
-$ traffic_ctl host down cdn-cache-02.foo.com --reason manual
-
-$ /opt/trafficserver/bin/traffic_ctl metric match host_status
-proxy.process.host_status.cdn-cache-01.foo.com HOST_STATUS_DOWN,ACTIVE:UP:0:0,LOCAL:UP:0:0,MANUAL:DOWN:1556896844:0,SELF_DETECT:UP:0:0
-proxy.process.host_status.cdn-cache-02.foo.com HOST_STATUS_UP,ACTIVE:UP:0:0,LOCAL:UP:0:0,MANUAL:UP:0:0,SELF_DETECT:UP:0:0
-proxy.process.host_status.cdn-cache-origin-01.foo.com HOST_STATUS_UP,ACTIVE:UP:0:0,LOCAL:UP:0:0,MANUAL:UP:0:0,SELF_DETECT:UP:0:0
-
-In the example above, 'cdn-cache-01.foo.com' is unavailable, `HOST_STATUS_DOWN` and was marked down 
-for the `manual` reason, `MANUAL:DOWN:1556896844:0`, at the time indicated by the UNIX time stamp 
-`1556896844`.  To make the host available, one would have to clear the `manual` reason using:: 
-`traffic_ctl host up cdn-cache-01.foo.com --reason manual`
-
-Configure Traffic Server to insert ``Via`` header in the response to
-the client::
-
-=======
 Configure Traffic Server to log in Squid format::
 
     $ traffic_ctl config set proxy.config.log.squid_log_enabled 1
diff --git a/iocore/net/I_NetProcessor.h b/iocore/net/I_NetProcessor.h
index c9b918a..03934ec 100644
--- a/iocore/net/I_NetProcessor.h
+++ b/iocore/net/I_NetProcessor.h
@@ -207,8 +207,6 @@ public:
   */
   virtual void init() = 0;
 
-  virtual void init_socks() = 0;
-
   inkcoreapi virtual NetVConnection *allocate_vc(EThread *) = 0;
 
   /** Private constructor. */
diff --git a/iocore/net/P_UnixNetProcessor.h b/iocore/net/P_UnixNetProcessor.h
index d125b7f..b076c0a 100644
--- a/iocore/net/P_UnixNetProcessor.h
+++ b/iocore/net/P_UnixNetProcessor.h
@@ -43,7 +43,6 @@ public:
   NetVConnection *allocate_vc(EThread *t) override;
 
   void init() override;
-  void init_socks() override;
 
   Event *accept_thread_event;
 
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index f796575..589c843 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -446,18 +446,7 @@ UnixNetProcessor::init()
   d.rec_int = 0;
   change_net_connections_throttle(nullptr, RECD_INT, d, nullptr);
 
-  /*
-   * Stat pages
-   */
-  extern Action *register_ShowNet(Continuation * c, HTTPHdr * h);
-  if (etype == ET_NET) {
-    statPagesManager.register_http("net", register_ShowNet);
-  }
-}
-
-void
-UnixNetProcessor::init_socks()
-{
+  // Socks
   if (!netProcessor.socks_conf_stuff) {
     socks_conf_stuff = new socks_conf_struct;
     loadSocksConfiguration(socks_conf_stuff);
@@ -470,6 +459,14 @@ UnixNetProcessor::init_socks()
       socks_conf_stuff = netProcessor.socks_conf_stuff;
     }
   }
+
+  /*
+   * Stat pages
+   */
+  extern Action *register_ShowNet(Continuation * c, HTTPHdr * h);
+  if (etype == ET_NET) {
+    statPagesManager.register_http("net", register_ShowNet);
+  }
 }
 
 // Virtual function allows creation of an
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 2a3b0c3..e0e590d 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -136,9 +136,9 @@ LocalManager::hostStatusSetDown(const char *marshalled_req, int len)
 }
 
 void
-LocalManager::hostStatusSetUp(const char *marshalled_req, int len)
+LocalManager::hostStatusSetUp(const char *marshalled_req)
 {
-  signalEvent(MGMT_EVENT_HOST_STATUS_UP, marshalled_req, len);
+  signalEvent(MGMT_EVENT_HOST_STATUS_UP, marshalled_req);
   return;
 }
 
diff --git a/mgmt/LocalManager.h b/mgmt/LocalManager.h
index 4dc34db..4ff3591 100644
--- a/mgmt/LocalManager.h
+++ b/mgmt/LocalManager.h
@@ -96,7 +96,7 @@ public:
   void rollLogFiles();
   void clearStats(const char *name = nullptr);
   void hostStatusSetDown(const char *marshalled_req, int len);
-  void hostStatusSetUp(const char *marshalled_req, int len);
+  void hostStatusSetUp(const char *marshalled_req);
 
   bool processRunning();
 
diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc
index e479eb6..5ebaf7f 100644
--- a/mgmt/api/CoreAPI.cc
+++ b/mgmt/api/CoreAPI.cc
@@ -885,12 +885,11 @@ EventSignalCbUnregister(const char *event_name, TSEventSignalFunc func)
  *-------------------------------------------------------------------------
  * Sets the HOST status to Down
  *
- * 'marshalled_req' is marshalled here, (host_name and down_time, na).
+ * 'marshalled_req' is marshalled here, (host_name and down_time).
  * 'len' is the length of the 'req' marshaled data.
- * 'na' unused.
  */
 TSMgmtError
-HostStatusSetDown(const char *marshalled_req, int len, const char *na)
+HostStatusSetDown(const char *marshalled_req, int len)
 {
   lmgmt->hostStatusSetDown(marshalled_req, len);
   return TS_ERR_OKAY;
@@ -902,13 +901,11 @@ HostStatusSetDown(const char *marshalled_req, int len, const char *na)
  * Sets the HOST status to Up
  *
  * 'marshalled_req' is marshalled here, host_name.
- * 'len' is the length of 'req'
- * 'na' unused.
  */
 TSMgmtError
-HostStatusSetUp(const char *marshalled_req, int len, const char *na)
+HostStatusSetUp(const char *marshalled_req)
 {
-  lmgmt->hostStatusSetUp(marshalled_req, len);
+  lmgmt->hostStatusSetUp(marshalled_req);
   return TS_ERR_OKAY;
 }
 
diff --git a/mgmt/api/CoreAPI.h b/mgmt/api/CoreAPI.h
index aa4a444..c6e3b1c 100644
--- a/mgmt/api/CoreAPI.h
+++ b/mgmt/api/CoreAPI.h
@@ -82,6 +82,6 @@ TSMgmtError EventIsActive(const char *event_name, bool *is_current);
 TSMgmtError EventSignalCbRegister(const char *event_name, TSEventSignalFunc func, void *data);
 TSMgmtError EventSignalCbUnregister(const char *event_name, TSEventSignalFunc func);
 
-TSMgmtError HostStatusSetDown(const char *host_name, int down_time, const char *reason);
-TSMgmtError HostStatusSetUp(const char *host_name, int down_time, const char *reason);
+TSMgmtError HostStatusSetDown(const char *host_name, int down_time);
+TSMgmtError HostStatusSetUp(const char *host_name);
 TSMgmtError StatsReset(const char *name = nullptr);
diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc
index 8406d78..67a6651 100644
--- a/mgmt/api/CoreAPIRemote.cc
+++ b/mgmt/api/CoreAPIRemote.cc
@@ -1033,28 +1033,26 @@ EventSignalCbUnregister(const char *event_name, TSEventSignalFunc func)
 }
 
 TSMgmtError
-HostStatusSetDown(const char *host_name, int down_time, const char *reason)
+HostStatusSetDown(const char *host_name, int down_time)
 {
+  fprintf(stderr, "%s:%s:%d - host_name: %s, down_time: %d\n", __FILE__, __func__, __LINE__, host_name, down_time);
   TSMgmtError ret         = TS_ERR_PARAMS;
   OpType op               = OpType::HOST_STATUS_DOWN;
   MgmtMarshallString name = const_cast<MgmtMarshallString>(host_name);
-  MgmtMarshallString re   = const_cast<MgmtMarshallString>(reason);
   MgmtMarshallInt dtime   = down_time;
 
-  ret = MGMTAPI_SEND_MESSAGE(main_socket_fd, op, &op, &name, &re, &dtime);
+  ret = MGMTAPI_SEND_MESSAGE(main_socket_fd, op, &op, &name, &dtime);
   return (ret == TS_ERR_OKAY) ? parse_generic_response(op, main_socket_fd) : ret;
 }
 
 TSMgmtError
-HostStatusSetUp(const char *host_name, int down_time, const char *reason)
+HostStatusSetUp(const char *host_name)
 {
   TSMgmtError ret         = TS_ERR_PARAMS;
   OpType op               = OpType::HOST_STATUS_UP;
   MgmtMarshallString name = const_cast<MgmtMarshallString>(host_name);
-  MgmtMarshallString re   = const_cast<MgmtMarshallString>(reason);
-  MgmtMarshallInt dtime   = down_time;
 
-  ret = MGMTAPI_SEND_MESSAGE(main_socket_fd, op, &op, &name, &re, &dtime);
+  ret = MGMTAPI_SEND_MESSAGE(main_socket_fd, op, &op, &name);
   return (ret == TS_ERR_OKAY) ? parse_generic_response(op, main_socket_fd) : ret;
 }
 
diff --git a/mgmt/api/INKMgmtAPI.cc b/mgmt/api/INKMgmtAPI.cc
index 15d2caf..9cb64ad 100644
--- a/mgmt/api/INKMgmtAPI.cc
+++ b/mgmt/api/INKMgmtAPI.cc
@@ -416,15 +416,15 @@ TSRecordEleDestroy(TSRecordEle *ele)
 
 /*--- host status operations ----------------------------------------------- */
 tsapi TSMgmtError
-TSHostStatusSetUp(const char *host_name, int down_time, const char *reason)
+TSHostStatusSetUp(const char *host_name)
 {
-  return HostStatusSetUp(host_name, down_time, reason);
+  return HostStatusSetUp(host_name);
 }
 
 tsapi TSMgmtError
-TSHostStatusSetDown(const char *host_name, int down_time, const char *reason)
+TSHostStatusSetDown(const char *host_name, int down_time)
 {
-  return HostStatusSetDown(host_name, down_time, reason);
+  return HostStatusSetDown(host_name, down_time);
 }
 
 /*--- statistics operations ----------------------------------------------- */
diff --git a/mgmt/api/NetworkMessage.cc b/mgmt/api/NetworkMessage.cc
index de2e7fa..9e5f35f 100644
--- a/mgmt/api/NetworkMessage.cc
+++ b/mgmt/api/NetworkMessage.cc
@@ -61,8 +61,8 @@ static const struct NetCmdOperation requests[] = {
   /* SERVER_BACKTRACE           */ {2, {MGMT_MARSHALL_INT, MGMT_MARSHALL_INT}},
   /* RECORD_DESCRIBE_CONFIG     */ {3, {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_INT}},
   /* LIFECYCLE_MESSAGE          */ {3, {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_DATA}},
-  /* HOST_STATUS_HOST_UP        */ {4, {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_STRING, MGMT_MARSHALL_INT}},
-  /* HOST_STATUS_HOST_DOWN      */ {4, {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_STRING, MGMT_MARSHALL_INT}},
+  /* HOST_STATUS_HOST_UP        */ {2, {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING}},
+  /* HOST_STATUS_HOST_DOWN      */ {3, {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_INT}},
 };
 
 // Responses always begin with a TSMgmtError code, followed by additional fields.
diff --git a/mgmt/api/TSControlMain.cc b/mgmt/api/TSControlMain.cc
index b7626bc..e709415 100644
--- a/mgmt/api/TSControlMain.cc
+++ b/mgmt/api/TSControlMain.cc
@@ -808,14 +808,12 @@ static TSMgmtError
 handle_host_status_up(int fd, void *req, size_t reqlen)
 {
   OpType optype;
-  MgmtMarshallString name   = nullptr;
-  MgmtMarshallString reason = nullptr;
+  MgmtMarshallString name = nullptr;
   MgmtMarshallInt err;
-  MgmtMarshallInt down_time;
 
-  err = recv_mgmt_request(req, reqlen, OpType::HOST_STATUS_UP, &optype, &name, &reason, &down_time);
+  err = recv_mgmt_request(req, reqlen, OpType::HOST_STATUS_UP, &optype, &name);
   if (err == TS_ERR_OKAY) {
-    lmgmt->signalEvent(MGMT_EVENT_HOST_STATUS_UP, static_cast<char *>(req), reqlen);
+    err = HostStatusSetUp(name);
   }
 
   ats_free(name);
@@ -832,12 +830,11 @@ static TSMgmtError
 handle_host_status_down(int fd, void *req, size_t reqlen)
 {
   OpType optype;
-  MgmtMarshallString name   = nullptr;
-  MgmtMarshallString reason = nullptr;
+  MgmtMarshallString name = nullptr;
   MgmtMarshallInt err;
   MgmtMarshallInt down_time;
 
-  err = recv_mgmt_request(req, reqlen, OpType::HOST_STATUS_DOWN, &optype, &name, &reason, &down_time);
+  err = recv_mgmt_request(req, reqlen, OpType::HOST_STATUS_DOWN, &optype, &name, &down_time);
   if (err == TS_ERR_OKAY) {
     lmgmt->signalEvent(MGMT_EVENT_HOST_STATUS_DOWN, static_cast<char *>(req), reqlen);
   }
diff --git a/mgmt/api/include/mgmtapi.h b/mgmt/api/include/mgmtapi.h
index 588592b..8fa22bc 100644
--- a/mgmt/api/include/mgmtapi.h
+++ b/mgmt/api/include/mgmtapi.h
@@ -428,8 +428,8 @@ tsapi TSMgmtError TSReadFromUrl(char *url, char **header, int *headerSize, char
  * NOTE: header and headerSize can be NULL
  */
 tsapi TSMgmtError TSReadFromUrlEx(const char *url, char **header, int *headerSize, char **body, int *bodySize, int timeout);
-tsapi TSMgmtError TSHostStatusSetUp(const char *host_name, int down_time, const char *reason);
-tsapi TSMgmtError TSHostStatusSetDown(const char *host_name, int down_time, const char *reason);
+tsapi TSMgmtError TSHostStatusSetUp(const char *host_name);
+tsapi TSMgmtError TSHostStatusSetDown(const char *host_name, int down_time);
 /*--- statistics operations -----------------------------------------------*/
 /* TSStatsReset: sets all the statistics variables to their default values
  * Outpue: TSErrr
diff --git a/proxy/HostStatus.h b/proxy/HostStatus.h
index 65e9e76..18f127e 100644
--- a/proxy/HostStatus.h
+++ b/proxy/HostStatus.h
@@ -23,157 +23,31 @@
 
 /*****************************************************************************
  *
- *  HostStatus.h - Interface to Host Status System
+ *  HostSelection.h - Interface to Host Selection System
  *
  *
  ****************************************************************************/
 
 #pragma once
 
-#include <time.h>
-#include <string>
-#include <sstream>
-#include "tscore/ink_rwlock.h"
+#include "ControlBase.h"
+#include "ControlMatcher.h"
 #include "records/P_RecProcess.h"
 
-#include <unordered_map>
-
-// host_status stats prefix.
-static const std::string stat_prefix = "proxy.process.host_status.";
-
 enum HostStatus_t {
   HOST_STATUS_INIT,
   HOST_STATUS_DOWN,
   HOST_STATUS_UP,
 };
 
-static const constexpr char *HostStatusNames[3] = {"HOST_STATUS_INIT", "HOST_STATUS_DOWN", "HOST_STATUS_UP"};
-static const constexpr char *ReasonStatus[2]    = {"UP", "DOWN"};
-
-struct Reason {
-  static constexpr const unsigned int ACTIVE      = 0x1;
-  static constexpr const unsigned int LOCAL       = 0x2;
-  static constexpr const unsigned int MANUAL      = 0x4;
-  static constexpr const unsigned int SELF_DETECT = 0x8;
-  static constexpr const unsigned int ALL         = 0xf;
-
-  static constexpr const char *ACTIVE_REASON      = "active";
-  static constexpr const char *LOCAL_REASON       = "local";
-  static constexpr const char *MANUAL_REASON      = "manual";
-  static constexpr const char *SELF_DETECT_REASON = "self_detect";
-  static constexpr const char *ALL_REASON         = "all";
-
-  static constexpr const char *reasons[5] = {ACTIVE_REASON, LOCAL_REASON, MANUAL_REASON, SELF_DETECT_REASON, ALL_REASON};
-
-  static bool
-  validReason(const char *reason)
-  {
-    for (const char *i : reasons) {
-      if (strcmp(i, reason) == 0) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  static unsigned int
-  getReason(const char *reason_str)
-  {
-    if (strcmp(reason_str, ACTIVE_REASON) == 0) {
-      return ACTIVE;
-    } else if (strcmp(reason_str, LOCAL_REASON) == 0) {
-      return LOCAL;
-    } else if (strcmp(reason_str, MANUAL_REASON) == 0) {
-      return MANUAL;
-    } else if (strcmp(reason_str, SELF_DETECT_REASON) == 0) {
-      return SELF_DETECT;
-    } else if (strcmp(reason_str, ALL_REASON) == 0) {
-      return ALL;
-    }
-    // default is MANUAL
-    return MANUAL;
-  }
-};
-
-// host status POD
-struct HostStatRec {
+struct HostStatRec_t {
   HostStatus_t status;
-  unsigned int reasons;
-  // time the host was marked down for a given reason.
-  time_t active_marked_down;
-  time_t local_marked_down;
-  time_t manual_marked_down;
-  time_t self_detect_marked_down;
-  // number of seconds that the host should be marked down for a given reason.
-  unsigned int active_down_time;
-  unsigned int local_down_time;
-  unsigned int manual_down_time;
-  unsigned int self_detect_down_time;
-
-  HostStatRec();
-  HostStatRec(std::string str);
-  HostStatRec(const HostStatRec &src)
-  {
-    status                  = src.status;
-    reasons                 = src.reasons;
-    active_marked_down      = src.active_marked_down;
-    active_down_time        = src.active_down_time;
-    local_marked_down       = src.local_marked_down;
-    local_down_time         = src.local_down_time;
-    manual_marked_down      = src.manual_marked_down;
-    manual_down_time        = src.manual_down_time;
-    self_detect_marked_down = src.self_detect_marked_down;
-    self_detect_down_time   = src.self_detect_down_time;
-  }
-  ~HostStatRec() {}
-
-  // serialize this HostStatusRec
-  std::stringstream &
-  operator<<(std::stringstream &os)
-  {
-    unsigned int r = getReasonState(Reason::ACTIVE);
-    os << HostStatusNames[status];
-    os << ",ACTIVE:" << ReasonStatus[r] << ":" << active_marked_down << ":" << active_down_time;
-    r = getReasonState(Reason::LOCAL);
-    os << ",LOCAL:" << ReasonStatus[r] << ":" << local_marked_down << ":" << local_down_time;
-    r = getReasonState(Reason::MANUAL);
-    os << ",MANUAL:" << ReasonStatus[r] << ":" << manual_marked_down << ":" << manual_down_time;
-    r = getReasonState(Reason::SELF_DETECT);
-    os << ",SELF_DETECT:" << ReasonStatus[r] << ":" << self_detect_marked_down << ":" << self_detect_down_time;
-
-    return os;
-  }
-
-  // serialize a HostStatRec
-  friend std::stringstream &
-  operator<<(std::stringstream &os, HostStatRec &hs)
-  {
-    unsigned int r = hs.getReasonState(Reason::ACTIVE);
-    os << HostStatusNames[hs.status];
-    os << ",ACTIVE:" << ReasonStatus[r] << ":" << hs.active_marked_down << ":" << hs.active_down_time;
-    r = hs.getReasonState(Reason::LOCAL);
-    os << ",LOCAL:" << ReasonStatus[r] << ":" << hs.local_marked_down << ":" << hs.local_down_time;
-    r = hs.getReasonState(Reason::MANUAL);
-    os << ",MANUAL:" << ReasonStatus[r] << ":" << hs.manual_marked_down << ":" << hs.manual_down_time;
-    r = hs.getReasonState(Reason::SELF_DETECT);
-    os << ",SELF_DETECT:" << ReasonStatus[r] << ":" << hs.self_detect_marked_down << ":" << hs.self_detect_down_time;
-
-    return os;
-  }
-
-  inline unsigned int
-  getReasonState(unsigned int reason)
-  {
-    unsigned int r = 0;
-    if (reasons == 0) {
-      r = 0;
-    } else if (reasons & reason) {
-      r = 1;
-    }
-    return r;
-  }
+  time_t marked_down;     // the time that this host was marked down.
+  unsigned int down_time; // number of seconds that the host should be down, 0 is indefinately
 };
 
+const std::string stat_prefix = "host_status.";
+
 /**
  * Singleton placeholder for next hop status.
  */
@@ -186,20 +60,19 @@ struct HostStatus {
     static HostStatus instance;
     return instance;
   }
-  void setHostStatus(const char *name, const HostStatus_t status, const unsigned int down_time, const unsigned int reason);
+  void setHostStatus(const char *name, const HostStatus_t status, const unsigned int down_time);
   HostStatus_t getHostStatus(const char *name);
-  void createHostStat(const char *name, const char *data = nullptr);
-  void loadHostStatusFromStats();
-  void loadRecord(std::string &name, HostStatRec &h);
-  int getHostStat(std::string &stat_name, char *buf, unsigned int buf_len);
+  void createHostStat(const char *name);
 
 private:
+  int next_stat_id = 1;
   HostStatus();
   HostStatus(const HostStatus &obj) = delete;
   HostStatus &operator=(HostStatus const &) = delete;
+  int getHostStatId(const char *name);
 
-  // next hop status, key is hostname or ip string, data is HostStatRec
-  std::unordered_map<std::string, HostStatRec *> hosts_statuses;
-
+  InkHashTable *hosts_statuses;  // next hop status, key is hostname or ip string, data is bool (available).
+  InkHashTable *hosts_stats_ids; // next hop stat ids, key is hostname or ip string, data is int stat id.
   ink_rwlock host_status_rwlock;
+  ink_rwlock host_statids_rwlock;
 };
diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc
index cbf83fc..496146d 100644
--- a/proxy/ParentSelection.cc
+++ b/proxy/ParentSelection.cc
@@ -369,7 +369,8 @@ ParentRecord::PreProcessParents(const char *val, const int line_num, char *buf,
           continue;
         } else {
           Debug("parent_select", "token: %s, matches this machine.  Marking down self from parent list at line %d", fqdn, line_num);
-          hs.setHostStatus(fqdn, HostStatus_t::HOST_STATUS_DOWN, 0, Reason::SELF_DETECT);
+          hs.createHostStat(fqdn);
+          hs.setHostStatus(fqdn, HostStatus_t::HOST_STATUS_DOWN, 0);
         }
       }
     } else {
@@ -381,7 +382,8 @@ ParentRecord::PreProcessParents(const char *val, const int line_num, char *buf,
         } else {
           Debug("parent_select", "token: %s, matches this machine.  Marking down self from parent list at line %d", token,
                 line_num);
-          hs.setHostStatus(token, HostStatus_t::HOST_STATUS_DOWN, 0, Reason::SELF_DETECT);
+          hs.createHostStat(token);
+          hs.setHostStatus(token, HostStatus_t::HOST_STATUS_DOWN, 0);
         }
       }
     }
@@ -412,7 +414,7 @@ ParentRecord::ProcessParents(char *val, bool isPrimary)
   int numTok          = 0;
   const char *current = nullptr;
   int port            = 0;
-  char *tmp = nullptr, *tmp2 = nullptr, *tmp3 = nullptr;
+  char *tmp = nullptr, *tmp2 = nullptr;
   const char *errPtr = nullptr;
   float weight       = 1.0;
 
@@ -465,27 +467,23 @@ ParentRecord::ProcessParents(char *val, bool isPrimary)
       }
     }
 
-    tmp3 = (char *)strchr(current, '&');
-
     // Make sure that is no garbage beyond the parent
-    //  port or weight
-    if (!tmp3) {
-      char *scan;
-      if (tmp2) {
-        scan = tmp2 + 1;
-      } else {
-        scan = tmp + 1;
-      }
-      for (; *scan != '\0' && (ParseRules::is_digit(*scan) || *scan == '.'); scan++) {
-        ;
-      }
-      for (; *scan != '\0' && ParseRules::is_wslfcr(*scan); scan++) {
-        ;
-      }
-      if (*scan != '\0') {
-        errPtr = "Garbage trailing entry or invalid separator";
-        goto MERROR;
-      }
+    //   port or weight
+    char *scan;
+    if (tmp2) {
+      scan = tmp2 + 1;
+    } else {
+      scan = tmp + 1;
+    }
+    for (; *scan != '\0' && (ParseRules::is_digit(*scan) || *scan == '.'); scan++) {
+      ;
+    }
+    for (; *scan != '\0' && ParseRules::is_wslfcr(*scan); scan++) {
+      ;
+    }
+    if (*scan != '\0') {
+      errPtr = "Garbage trailing entry or invalid separator";
+      goto MERROR;
     }
     // Check to make sure that the string will fit in the
     //  pRecord
@@ -508,13 +506,7 @@ ParentRecord::ProcessParents(char *val, bool isPrimary)
       this->parents[i].name                    = this->parents[i].hostname;
       this->parents[i].available               = true;
       this->parents[i].weight                  = weight;
-      if (tmp3) {
-        memcpy(this->parents[i].hash_string, tmp3 + 1, strlen(tmp3));
-        this->parents[i].name = this->parents[i].hash_string;
-      }
-      if (hs.getHostStatus(this->parents[i].hostname) == HostStatus_t::HOST_STATUS_INIT) {
-        hs.setHostStatus(this->parents[i].hostname, HOST_STATUS_UP, 0, Reason::MANUAL);
-      }
+      hs.createHostStat(this->parents[i].hostname);
     } else {
       memcpy(this->secondary_parents[i].hostname, current, tmp - current);
       this->secondary_parents[i].hostname[tmp - current] = '\0';
@@ -526,15 +518,8 @@ ParentRecord::ProcessParents(char *val, bool isPrimary)
       this->secondary_parents[i].name                    = this->secondary_parents[i].hostname;
       this->secondary_parents[i].available               = true;
       this->secondary_parents[i].weight                  = weight;
-      if (tmp3) {
-        memcpy(this->secondary_parents[i].hash_string, tmp3 + 1, strlen(tmp3));
-        this->secondary_parents[i].name = this->secondary_parents[i].hash_string;
-      }
-      if (hs.getHostStatus(this->secondary_parents[i].hostname) == HostStatus_t::HOST_STATUS_INIT) {
-        hs.setHostStatus(this->secondary_parents[i].hostname, HOST_STATUS_UP, 0, Reason::MANUAL);
-      }
+      hs.createHostStat(this->secondary_parents[i].hostname);
     }
-    tmp3 = nullptr;
   }
 
   if (isPrimary) {
@@ -819,7 +804,7 @@ ParentRecord::Print()
 {
   printf("\t\t");
   for (int i = 0; i < num_parents; i++) {
-    printf(" %s:%d|%f&%s ", parents[i].hostname, parents[i].port, parents[i].weight, parents[i].name);
+    printf(" %s:%d ", parents[i].hostname, parents[i].port);
   }
   printf(" direct=%s\n", (go_direct == true) ? "true" : "false");
   printf(" parent_is_proxy=%s\n", (parent_is_proxy == true) ? "true" : "false");
@@ -1444,7 +1429,7 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
   // Test 184
   // mark fuzzy down with HostStatus API.
   HostStatus &_st = HostStatus::instance();
-  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0, Reason::MANUAL);
+  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0);
 
   ST(184);
   REINIT;
@@ -1455,7 +1440,7 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
 
   // Test 185
   // mark fluffy down and expect furry to be chosen
-  _st.setHostStatus("fluffy", HOST_STATUS_DOWN, 0, Reason::MANUAL);
+  _st.setHostStatus("fluffy", HOST_STATUS_DOWN, 0);
 
   ST(185);
   REINIT;
@@ -1466,9 +1451,9 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
 
   // Test 186
   // mark furry and frisky down, fuzzy up and expect fuzzy to be chosen
-  _st.setHostStatus("furry", HOST_STATUS_DOWN, 0, Reason::MANUAL);
-  _st.setHostStatus("frisky", HOST_STATUS_DOWN, 0, Reason::MANUAL);
-  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0, Reason::MANUAL);
+  _st.setHostStatus("furry", HOST_STATUS_DOWN, 0);
+  _st.setHostStatus("frisky", HOST_STATUS_DOWN, 0);
+  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0);
 
   ST(186);
   REINIT;
@@ -1486,10 +1471,10 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
   REBUILD;
 
   // mark all up.
-  _st.setHostStatus("furry", HOST_STATUS_UP, 0, Reason::MANUAL);
-  _st.setHostStatus("fluffy", HOST_STATUS_UP, 0, Reason::MANUAL);
-  _st.setHostStatus("frisky", HOST_STATUS_UP, 0, Reason::MANUAL);
-  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0, Reason::MANUAL);
+  _st.setHostStatus("furry", HOST_STATUS_UP, 0);
+  _st.setHostStatus("fluffy", HOST_STATUS_UP, 0);
+  _st.setHostStatus("frisky", HOST_STATUS_UP, 0);
+  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0);
 
   REINIT;
   br(request, "i.am.rabbit.net");
@@ -1499,7 +1484,7 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
 
   // Test 188
   // mark fuzzy down and expect fluffy.
-  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0, Reason::MANUAL);
+  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0);
 
   ST(188);
   REINIT;
@@ -1510,7 +1495,7 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
 
   // Test 189
   // mark fuzzy back up and expect fuzzy.
-  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0, Reason::MANUAL);
+  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0);
 
   ST(189);
   REINIT;
@@ -1526,7 +1511,7 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
   // because the host status is set to down.
   params->markParentDown(result, fail_threshold, retry_time);
   // set host status down
-  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0, Reason::MANUAL);
+  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0);
   // sleep long enough so that fuzzy is retryable
   sleep(params->policy.ParentRetryTime + 1);
   ST(190);
@@ -1537,7 +1522,7 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
 
   // now set the host staus on fuzzy to up and it should now
   // be retried.
-  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0, Reason::MANUAL);
+  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0);
   ST(191);
   REINIT;
   br(request, "i.am.rabbit.net");
@@ -1550,10 +1535,10 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
   T("dest_domain=rabbit.net parent=fuzzy:80,fluffy:80,furry:80,frisky:80 round_robin=false go_direct=true\n");
   REBUILD;
   // mark all up.
-  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0, Reason::MANUAL);
-  _st.setHostStatus("fluffy", HOST_STATUS_UP, 0, Reason::MANUAL);
-  _st.setHostStatus("furry", HOST_STATUS_UP, 0, Reason::MANUAL);
-  _st.setHostStatus("frisky", HOST_STATUS_UP, 0, Reason::MANUAL);
+  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0);
+  _st.setHostStatus("fluffy", HOST_STATUS_UP, 0);
+  _st.setHostStatus("furry", HOST_STATUS_UP, 0);
+  _st.setHostStatus("frisky", HOST_STATUS_UP, 0);
   // fuzzy should be chosen.
   sleep(1);
   REINIT;
@@ -1568,7 +1553,7 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
   sleep(params->policy.ParentRetryTime + 1);
   // since the host status is down even though fuzzy is
   // retryable, fluffy should be chosen
-  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0, Reason::MANUAL);
+  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0);
   REINIT;
   br(request, "i.am.rabbit.net");
   FP;
@@ -1578,7 +1563,7 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
   // set the host status for fuzzy  back up and since its
   // retryable fuzzy should be chosen
   ST(194);
-  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0, Reason::MANUAL);
+  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0);
   REINIT;
   br(request, "i.am.rabbit.net");
   FP;
@@ -1699,7 +1684,7 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
   T("dest_domain=rabbit.net parent=fuzzy:80|1.0;fluffy:80|1.0 secondary_parent=furry:80|1.0;frisky:80|1.0 "
     "round_robin=consistent_hash go_direct=false secondary_mode=3\n");
   REBUILD;
-  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0, Reason::MANUAL);
+  _st.setHostStatus("fuzzy", HOST_STATUS_DOWN, 0);
   REINIT;
   br(request, "i.am.rabbit.net");
   FP;
@@ -1735,52 +1720,6 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED */,
   sleep(1);
   RE(verify(result, PARENT_FAIL, nullptr, 80), 208);
 
-  // Tests 209 through 211 test that host selection is based upon the hash_string
-
-  // Test 209
-  // fuzzy { curly larry, moe } fluffy
-  tbl[0] = '\0';
-  ST(209);
-  T("dest_domain=stooges.net parent=curly:80|1.0&myhash;joe:80|1.0&hishash;larry:80|1.0&ourhash "
-    "round_robin=consistent_hash go_direct=false\n");
-  REBUILD;
-  REINIT;
-  br(request, "i.am.stooges.net");
-  FP;
-  RE(verify(result, PARENT_SPECIFIED, "larry", 80), 209);
-
-  // Test 210
-  // fuzzy { curly larry, moe } fluffy
-  tbl[0] = '\0';
-  ST(210);
-  T("dest_domain=stooges.net parent=curly:80|1.0&ourhash;joe:80|1.0&hishash;larry:80|1.0&myhash "
-    "round_robin=consistent_hash go_direct=false\n");
-  REBUILD;
-  REINIT;
-  br(request, "i.am.stooges.net");
-  FP;
-  RE(verify(result, PARENT_SPECIFIED, "curly", 80), 210);
-
-  // Test 211
-  // fuzzy { curly larry, moe } fluffy
-  tbl[0] = '\0';
-  ST(211);
-  T("dest_domain=stooges.net parent=curly:80|1.0&ourhash;joe:80|1.0&hishash;larry:80|1.0&myhash "
-    "secondary_parent=carol:80|1.0&ourhash;betty:80|1.0&hishash;donna:80|1.0&myhash "
-    "round_robin=consistent_hash go_direct=false\n");
-  REBUILD;
-  REINIT;
-  _st.setHostStatus("curly", HOST_STATUS_DOWN, 0, Reason::MANUAL);
-  br(request, "i.am.stooges.net");
-  FP;
-  RE(verify(result, PARENT_SPECIFIED, "carol", 80), 211);
-
-  // cleanup, allow changes to be persisted to records.snap
-  // so that subsequent test runs do not fail unexpectedly.
-  _st.setHostStatus("curly", HOST_STATUS_UP, 0, Reason::MANUAL);
-  _st.setHostStatus("fuzzy", HOST_STATUS_UP, 0, Reason::MANUAL);
-  sleep(2);
-
   delete request;
   delete result;
   delete params;
diff --git a/proxy/ParentSelection.h b/proxy/ParentSelection.h
index c16684f..ee3dcab 100644
--- a/proxy/ParentSelection.h
+++ b/proxy/ParentSelection.h
@@ -103,7 +103,6 @@ struct pRecord : ATSConsistentHashNode {
   const char *scheme; // for which parent matches (if any)
   int idx;
   float weight;
-  char hash_string[MAXDNAME + 1];
 };
 
 typedef ControlMatcher<ParentRecord, ParentResult> P_table;
diff --git a/proxy/shared/UglyLogStubs.cc b/proxy/shared/UglyLogStubs.cc
index c54f560..ce4d97b 100644
--- a/proxy/shared/UglyLogStubs.cc
+++ b/proxy/shared/UglyLogStubs.cc
@@ -104,12 +104,6 @@ UnixNetProcessor::init()
   ink_release_assert(false);
 }
 
-void
-UnixNetProcessor::init_socks()
-{
-  ink_release_assert(false);
-}
-
 // TODO: The following was necessary only for Solaris, should examine more.
 NetVCOptions const Connection::DEFAULT_OPTIONS;
 NetProcessor::AcceptOptions const NetProcessor::DEFAULT_ACCEPT_OPTIONS;
diff --git a/src/traffic_ctl/Makefile.inc b/src/traffic_ctl/Makefile.inc
index 1efd85e..15cc1ec 100644
--- a/src/traffic_ctl/Makefile.inc
+++ b/src/traffic_ctl/Makefile.inc
@@ -26,7 +26,6 @@ traffic_ctl_traffic_ctl_CPPFLAGS = \
     -I$(abs_top_srcdir)/lib \
     -I$(abs_top_srcdir)/mgmt \
     -I$(abs_top_srcdir)/mgmt/api/include \
-    -I$(abs_top_srcdir)/proxy \
     $(TS_INCLUDES)
 
 traffic_ctl_traffic_ctl_SOURCES = \
diff --git a/src/traffic_ctl/host.cc b/src/traffic_ctl/host.cc
index 244557d..2607804 100644
--- a/src/traffic_ctl/host.cc
+++ b/src/traffic_ctl/host.cc
@@ -20,11 +20,9 @@
   See the License for the specific language governing permissions and
   limitations under the License.
  */
-
 #include "traffic_ctl.h"
-#include "HostStatus.h"
-#include <records/P_RecUtils.h>
-
+#include "records/P_RecUtils.h"
+const std::string stat_prefix = "host_status.";
 static int
 status_get(unsigned argc, const char **argv)
 {
@@ -55,89 +53,40 @@ static int
 status_down(unsigned argc, const char **argv)
 {
   int down_time     = 0;
-  char *reason      = nullptr;
   const char *usage = "host down HOST [OPTIONS]";
 
   const ArgumentDescription opts[] = {
-    {"time", 'I', "number of seconds that a host is marked down", "I", &down_time, nullptr, nullptr},
-    // memory is allocated for 'reason', if this option is used
-    {"reason", '-', "reason for marking the host down, one of 'manual|active|local'", "S*", &reason, nullptr, nullptr},
-  };
+    {"time", 'I', "number of seconds that a host is marked down", "I", &down_time, nullptr, nullptr}};
 
   if (!CtrlProcessArguments(argc, argv, opts, countof(opts)) || n_file_arguments < 1) {
     return CtrlCommandUsage(usage, opts, countof(opts));
   }
 
-  for (unsigned i = 0; i < n_file_arguments; i++) {
-    if (strncmp(file_arguments[i], "--", 2) == 0) {
-      fprintf(stderr, "Invalid syntax, Usage: %s\n", usage);
-      return CTRL_EX_ERROR;
-    }
-  }
-
-  // if reason is not set, set it to manual (default)
-  if (reason == nullptr) {
-    reason = ats_strdup(Reason::MANUAL_REASON);
-  }
-
-  if (!Reason::validReason(reason)) {
-    fprintf(stderr, "\nInvalid reason: '%s'\n\n", reason);
-    return CtrlCommandUsage(usage, opts, countof(opts));
-  }
-
   TSMgmtError error = TS_ERR_OKAY;
   for (unsigned i = 0; i < n_file_arguments; ++i) {
-    error = TSHostStatusSetDown(file_arguments[i], down_time, reason);
+    error = TSHostStatusSetDown(file_arguments[i], down_time);
     if (error != TS_ERR_OKAY) {
       CtrlMgmtError(error, "failed to set %s", file_arguments[i]);
       return CTRL_EX_ERROR;
     }
   }
-  ats_free(reason);
 
   return CTRL_EX_OK;
 }
 static int
 status_up(unsigned argc, const char **argv)
 {
-  char *reason      = nullptr;
-  const char *usage = "host up HOST [OPTIONS]";
-
-  const ArgumentDescription opts[] = {
-    // memory is allocated for 'reason', if this option is used
-    {"reason", '-', "reason for marking the host up, one of 'manual|active|local'", "S*", &reason, nullptr, nullptr},
-  };
-
-  if (!CtrlProcessArguments(argc, argv, opts, countof(opts)) || n_file_arguments < 1) {
-    return CtrlCommandUsage(usage, nullptr, 0);
-  }
-
-  for (unsigned i = 0; i < n_file_arguments; i++) {
-    if (strncmp(file_arguments[i], "--", 2) == 0) {
-      fprintf(stderr, "Invalid syntax, Usage: %s\n", usage);
-      return CTRL_EX_ERROR;
-    }
-  }
-
-  // if reason is not set, set it to manual (default)
-  if (reason == nullptr) {
-    reason = ats_strdup(Reason::MANUAL_REASON);
-  }
-
-  if (!Reason::validReason(reason)) {
-    fprintf(stderr, "\nInvalid reason: '%s'\n\n", reason);
-    return CtrlCommandUsage(usage, opts, countof(opts));
+  if (!CtrlProcessArguments(argc, argv, nullptr, 0) || n_file_arguments < 1) {
+    return CtrlCommandUsage("host up METRIC value", nullptr, 0);
   }
-
   TSMgmtError error;
   for (unsigned i = 0; i < n_file_arguments; ++i) {
-    error = TSHostStatusSetUp(file_arguments[i], 0, reason);
+    error = TSHostStatusSetUp(file_arguments[i]);
     if (error != TS_ERR_OKAY) {
       CtrlMgmtError(error, "failed to set %s", file_arguments[i]);
       return CTRL_EX_ERROR;
     }
   }
-  ats_free(reason);
 
   return CTRL_EX_OK;
 }
diff --git a/src/traffic_server/HostStatus.cc b/src/traffic_server/HostStatus.cc
index 44a646b..e210ee5 100644
--- a/src/traffic_server/HostStatus.cc
+++ b/src/traffic_server/HostStatus.cc
@@ -25,40 +25,13 @@
 
 static RecRawStatBlock *host_status_rsb = nullptr;
 
-inline void
-getStatName(std::string &stat_name, const char *name)
-{
-  stat_name = stat_prefix + name;
-}
-
 static void *
 mgmt_host_status_up_callback(void *x, char *data, int len)
 {
-  MgmtInt op;
-  MgmtMarshallString name;
-  MgmtMarshallInt down_time;
-  MgmtMarshallString reason_str;
-  std::string stat_name;
-  char buf[1024]                         = {0};
-  static const MgmtMarshallType fields[] = {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_STRING, MGMT_MARSHALL_INT};
-  Debug("host_statuses", "%s:%s:%d - data: %s, len: %d\n", __FILE__, __func__, __LINE__, data, len);
-
-  if (mgmt_message_parse(data, len, fields, countof(fields), &op, &name, &reason_str, &down_time) == -1) {
-    Error("Plugin message - RPC parsing error - message discarded.");
-  }
-  Debug("host_statuses", "op: %ld, name: %s, down_time: %d, reason_str: %s", static_cast<long>(op), name,
-        static_cast<int>(down_time), reason_str);
-
-  unsigned int reason = Reason::getReason(reason_str);
-
-  getStatName(stat_name, name);
   if (data != nullptr) {
     Debug("host_statuses", "marking up server %s", data);
     HostStatus &hs = HostStatus::instance();
-    if (hs.getHostStat(stat_name, buf, 1024) == REC_ERR_FAIL) {
-      hs.createHostStat(name);
-    }
-    hs.setHostStatus(name, HostStatus_t::HOST_STATUS_UP, down_time, reason);
+    hs.setHostStatus(data, HostStatus_t::HOST_STATUS_UP, 0);
   }
   return nullptr;
 }
@@ -69,291 +42,86 @@ mgmt_host_status_down_callback(void *x, char *data, int len)
   MgmtInt op;
   MgmtMarshallString name;
   MgmtMarshallInt down_time;
-  MgmtMarshallString reason_str;
-  std::string stat_name;
-  char buf[1024]                         = {0};
-  static const MgmtMarshallType fields[] = {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_STRING, MGMT_MARSHALL_INT};
+  static const MgmtMarshallType fields[] = {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_INT};
   Debug("host_statuses", "%s:%s:%d - data: %s, len: %d\n", __FILE__, __func__, __LINE__, data, len);
 
-  if (mgmt_message_parse(data, len, fields, countof(fields), &op, &name, &reason_str, &down_time) == -1) {
+  if (mgmt_message_parse(data, len, fields, countof(fields), &op, &name, &down_time) == -1) {
     Error("Plugin message - RPC parsing error - message discarded.");
   }
-  Debug("host_statuses", "op: %ld, name: %s, down_time: %d, reason_str: %s", static_cast<long>(op), name,
-        static_cast<int>(down_time), reason_str);
-
-  unsigned int reason = Reason::getReason(reason_str);
+  Debug("host_statuses", "op: %ld, name: %s, down_time: %d", static_cast<long>(op), name, static_cast<int>(down_time));
 
   if (data != nullptr) {
     Debug("host_statuses", "marking down server %s", name);
     HostStatus &hs = HostStatus::instance();
-    if (hs.getHostStat(stat_name, buf, 1024) == REC_ERR_FAIL) {
-      hs.createHostStat(name);
-    }
-    hs.setHostStatus(name, HostStatus_t::HOST_STATUS_DOWN, down_time, reason);
+    hs.setHostStatus(name, HostStatus_t::HOST_STATUS_DOWN, down_time);
   }
   return nullptr;
 }
 
-HostStatRec::HostStatRec()
-  : status(HOST_STATUS_UP),
-    reasons(0),
-    active_marked_down(0),
-    local_marked_down(0),
-    manual_marked_down(0),
-    self_detect_marked_down(0),
-    active_down_time(0),
-    local_down_time(0),
-    manual_down_time(0),
-    self_detect_down_time(0){};
-
-HostStatRec::HostStatRec(std::string str)
-{
-  std::vector<std::string> v1;
-  std::stringstream ss1(str);
-
-  reasons = 0;
-
-  // parse the csv strings from the stat record value string.
-  while (ss1.good()) {
-    char b1[64];
-    ss1.getline(b1, 64, ',');
-    v1.push_back(b1);
-  }
-
-  // v1 contains 5 strings.
-  ink_assert(v1.size() == 5);
-
-  // set the status and reasons fields.
-  for (unsigned int i = 0; i < v1.size(); i++) {
-    if (i == 0) { // set the status field
-      if (v1.at(i).compare("HOST_STATUS_UP") == 0) {
-        status = HOST_STATUS_UP;
-      } else if (v1.at(i).compare("HOST_STATUS_DOWN") == 0) {
-        status = HOST_STATUS_DOWN;
-      }
-    } else { // parse and set remaining reason fields.
-      std::vector<std::string> v2;
-      v2.clear();
-      std::stringstream ss2(v1.at(i));
-      while (ss2.good()) {
-        char b2[64];
-        ss2.getline(b2, 64, ':');
-        v2.push_back(b2);
-      }
-      // v2 contains 4 strings.
-      ink_assert(v2.size() == 4);
-
-      if (v2.at(0).compare("ACTIVE") == 0) {
-        if (v2.at(1).compare("DOWN") == 0) {
-          reasons |= Reason::ACTIVE;
-        } else if (reasons & Reason::ACTIVE) {
-          reasons ^= Reason::ACTIVE;
-        }
-        active_marked_down = atoi(v2.at(2).c_str());
-        active_down_time   = atoi(v2.at(3).c_str());
-      }
-      if (v2.at(0).compare("LOCAL") == 0) {
-        if (v2.at(1).compare("DOWN") == 0) {
-          reasons |= Reason::LOCAL;
-        } else if (reasons & Reason::LOCAL) {
-          reasons ^= Reason::LOCAL;
-        }
-        local_marked_down = atoi(v2.at(2).c_str());
-        local_down_time   = atoi(v2.at(3).c_str());
-      }
-      if (v2.at(0).compare("MANUAL") == 0) {
-        if (v2.at(1).compare("DOWN") == 0) {
-          reasons |= Reason::MANUAL;
-        } else if (reasons & Reason::MANUAL) {
-          reasons ^= Reason::MANUAL;
-        }
-        manual_marked_down = atoi(v2.at(2).c_str());
-        manual_down_time   = atoi(v2.at(3).c_str());
-      }
-      if (v2.at(0).compare("SELF_DETECT") == 0) {
-        if (v2.at(1).compare("DOWN") == 0) {
-          reasons |= Reason::SELF_DETECT;
-        } else if (reasons & Reason::SELF_DETECT) {
-          reasons ^= Reason::SELF_DETECT;
-        }
-        self_detect_marked_down = atoi(v2.at(2).c_str());
-        self_detect_down_time   = atoi(v2.at(3).c_str());
-      }
-    }
-  }
-}
-
-static void
-handle_record_read(const RecRecord *rec, void *edata)
-{
-  HostStatus &hs = HostStatus::instance();
-  std::string hostname;
-
-  if (rec) {
-    Debug("host_statuses", "name: %s", rec->name);
-
-    // parse the hostname from the stat name
-    char *s = const_cast<char *>(rec->name);
-    // 1st move the pointer past the stat prefix.
-    s += stat_prefix.length();
-    hostname = s;
-    hs.createHostStat(hostname.c_str(), rec->data.rec_string);
-    HostStatRec h(rec->data.rec_string);
-    hs.loadRecord(hostname, h);
-  }
-}
-
 HostStatus::HostStatus()
 {
+  hosts_statuses  = ink_hash_table_create(InkHashTableKeyType_String);
+  hosts_stats_ids = ink_hash_table_create(InkHashTableKeyType_String);
   ink_rwlock_init(&host_status_rwlock);
-  pmgmt->registerMgmtCallback(MGMT_EVENT_HOST_STATUS_UP, &mgmt_host_status_up_callback);
-  pmgmt->registerMgmtCallback(MGMT_EVENT_HOST_STATUS_DOWN, &mgmt_host_status_down_callback);
+  ink_rwlock_init(&host_statids_rwlock);
+  Debug("host_statuses", "registering ostas");
+  pmgmt->registerMgmtCallback(MGMT_EVENT_HOST_STATUS_UP, mgmt_host_status_up_callback, nullptr);
+  pmgmt->registerMgmtCallback(MGMT_EVENT_HOST_STATUS_DOWN, mgmt_host_status_down_callback, nullptr);
   host_status_rsb = RecAllocateRawStatBlock((int)TS_MAX_API_STATS);
 }
 
 HostStatus::~HostStatus()
 {
-  for (auto &&it : hosts_statuses) {
-    ats_free(it.second);
-  }
-  // release the read and writer locks.
-  ink_rwlock_destroy(&host_status_rwlock);
-}
+  // release host_statues hash table.
+  InkHashTableIteratorState ht_iter;
+  InkHashTableEntry *ht_entry = nullptr;
+  ht_entry                    = ink_hash_table_iterator_first(hosts_statuses, &ht_iter);
 
-void
-HostStatus::loadHostStatusFromStats()
-{
-  if (RecLookupMatchingRecords(RECT_PROCESS, stat_prefix.c_str(), handle_record_read, nullptr) != REC_ERR_OKAY) {
-    Error("[HostStatus] - While loading HostStatus stats, there was an Error reading HostStatus stats.");
+  while (ht_entry != nullptr) {
+    HostStatRec_t *value = static_cast<HostStatRec_t *>(ink_hash_table_entry_value(hosts_statuses, ht_entry));
+    ats_free(value);
+    ht_entry = ink_hash_table_iterator_next(hosts_statuses, &ht_iter);
   }
+  ink_hash_table_destroy(hosts_statuses);
+
+  // release host_stats_ids hash and the read and writer locks.
+  ink_hash_table_destroy(hosts_stats_ids);
+  ink_rwlock_destroy(&host_status_rwlock);
+  ink_rwlock_destroy(&host_statids_rwlock);
 }
 
 void
-HostStatus::loadRecord(std::string &name, HostStatRec &h)
+HostStatus::setHostStatus(const char *name, HostStatus_t status, const unsigned int down_time)
 {
-  HostStatRec *host_stat = nullptr;
-  Debug("host_statuses", "loading host status record for %s", name.c_str());
-  ink_rwlock_wrlock(&host_status_rwlock);
-  {
-    if (auto it = hosts_statuses.find(name.c_str()); it != hosts_statuses.end()) {
-      host_stat = it->second;
+  int stat_id = getHostStatId(name);
+  if (stat_id != -1) {
+    if (status == HostStatus_t::HOST_STATUS_UP) {
+      Debug("host_statuses", "set stat for :  name: %s, status: %d", name, status);
+      RecSetRawStatCount(host_status_rsb, stat_id, 1);
+      RecSetRawStatSum(host_status_rsb, stat_id, 1);
     } else {
-      host_stat  = static_cast<HostStatRec *>(ats_malloc(sizeof(HostStatRec)));
-      *host_stat = h;
-      hosts_statuses.emplace(name, host_stat);
+      RecSetRawStatCount(host_status_rsb, stat_id, 0);
+      RecSetRawStatSum(host_status_rsb, stat_id, 0);
+      Debug("host_statuses", "clear stat for :  name: %s, status: %d", name, status);
     }
   }
-  ink_rwlock_unlock(&host_status_rwlock);
-
-  *host_stat = h;
-}
-
-void
-HostStatus::setHostStatus(const char *name, HostStatus_t status, const unsigned int down_time, const unsigned int reason)
-{
-  std::string stat_name;
-  char buf[1024] = {0};
-
-  getStatName(stat_name, name);
-
-  if (getHostStat(stat_name, buf, 1024) == REC_ERR_FAIL) {
-    createHostStat(name);
-  }
-
-  int result = getHostStat(stat_name, buf, 1024);
-
+  Debug("host_statuses", "name: %s, status: %d", name, status);
   // update / insert status.
   // using the hash table pointer to store the HostStatus_t value.
-  HostStatRec *host_stat = nullptr;
+  HostStatRec_t *host_stat = nullptr;
   ink_rwlock_wrlock(&host_status_rwlock);
-  {
-    if (auto it = hosts_statuses.find(name); it != hosts_statuses.end()) {
-      host_stat = it->second;
-    } else {
-      host_stat = static_cast<HostStatRec *>(ats_malloc(sizeof(HostStatRec)));
-      bzero(host_stat, sizeof(HostStatRec));
-      hosts_statuses.emplace(name, host_stat);
-    }
-    if (reason & Reason::ACTIVE) {
-      Debug("host_statuses", "for host %s set status: %s, Reason:ACTIVE", name, HostStatusNames[status]);
-      if (status == HostStatus_t::HOST_STATUS_DOWN) {
-        host_stat->active_marked_down = time(0);
-        host_stat->active_down_time   = down_time;
-        host_stat->reasons |= Reason::ACTIVE;
-      } else {
-        host_stat->active_marked_down = 0;
-        host_stat->active_down_time   = 0;
-        if (host_stat->reasons & Reason::ACTIVE) {
-          host_stat->reasons ^= Reason::ACTIVE;
-        }
-      }
-    }
-    if (reason & Reason::LOCAL) {
-      Debug("host_statuses", "for host %s set status: %s, Reason:LOCAL", name, HostStatusNames[status]);
-      if (status == HostStatus_t::HOST_STATUS_DOWN) {
-        host_stat->local_marked_down = time(0);
-        host_stat->local_down_time   = down_time;
-        host_stat->reasons |= Reason::LOCAL;
-      } else {
-        host_stat->local_marked_down = 0;
-        host_stat->local_down_time   = 0;
-        if (host_stat->reasons & Reason::LOCAL) {
-          host_stat->reasons ^= Reason::LOCAL;
-        }
-      }
-    }
-    if (reason & Reason::MANUAL) {
-      Debug("host_statuses", "for host %s set status: %s, Reason:MANUAL", name, HostStatusNames[status]);
-      if (status == HostStatus_t::HOST_STATUS_DOWN) {
-        host_stat->manual_marked_down = time(0);
-        host_stat->manual_down_time   = down_time;
-        host_stat->reasons |= Reason::MANUAL;
-      } else {
-        host_stat->manual_marked_down = 0;
-        host_stat->manual_down_time   = 0;
-        if (host_stat->reasons & Reason::MANUAL) {
-          host_stat->reasons ^= Reason::MANUAL;
-        }
-      }
-    }
-    if (reason & Reason::SELF_DETECT) {
-      Debug("host_statuses", "for host %s set status: %s, Reason:SELF_DETECT", name, HostStatusNames[status]);
-      if (status == HostStatus_t::HOST_STATUS_DOWN) {
-        host_stat->self_detect_marked_down = time(0);
-        host_stat->self_detect_down_time   = down_time;
-        host_stat->reasons |= Reason::SELF_DETECT;
-      } else {
-        host_stat->self_detect_marked_down = 0;
-        host_stat->self_detect_down_time   = 0;
-        if (host_stat->reasons & Reason::SELF_DETECT) {
-          host_stat->reasons ^= Reason::SELF_DETECT;
-        }
-      }
-    }
-    if (status == HostStatus_t::HOST_STATUS_UP) {
-      if (host_stat->reasons == 0) {
-        host_stat->status = HostStatus_t::HOST_STATUS_UP;
-      }
-      Debug("host_statuses", "reasons: %d, status: %s", host_stat->reasons, HostStatusNames[host_stat->status]);
-    } else {
-      host_stat->status = status;
-      Debug("host_statuses", "reasons: %d, status: %s", host_stat->reasons, HostStatusNames[host_stat->status]);
-    }
+  if (ink_hash_table_lookup(hosts_statuses, name, reinterpret_cast<InkHashTableValue *>(&host_stat)) == 0) {
+    host_stat = static_cast<HostStatRec_t *>(ats_malloc(sizeof(HostStatRec_t)));
+    ink_hash_table_insert(hosts_statuses, name, reinterpret_cast<InkHashTableValue *>(host_stat));
   }
-  ink_rwlock_unlock(&host_status_rwlock);
-
-  // update the stats
-  if (result == REC_ERR_OKAY) {
-    std::stringstream status_rec;
-    status_rec << *host_stat;
-    RecSetRecordString(stat_name.c_str(), const_cast<char *>(status_rec.str().c_str()), REC_SOURCE_EXPLICIT, true, false);
-    if (status == HostStatus_t::HOST_STATUS_UP) {
-      Debug("host_statuses", "set status up for name: %s, status: %d, stat_name: %s", name, status, stat_name.c_str());
-    } else {
-      Debug("host_statuses", "set status down for name: %s, status: %d, stat_name: %s", name, status, stat_name.c_str());
-    }
+  host_stat->status    = status;
+  host_stat->down_time = down_time;
+  if (status == HostStatus_t::HOST_STATUS_DOWN) {
+    host_stat->marked_down = time(0);
+  } else {
+    host_stat->marked_down = 0;
   }
-  Debug("host_statuses", "name: %s, status: %d", name, status);
+  ink_rwlock_unlock(&host_status_rwlock);
 
   // log it.
   if (status == HostStatus_t::HOST_STATUS_DOWN) {
@@ -366,93 +134,55 @@ HostStatus::setHostStatus(const char *name, HostStatus_t status, const unsigned
 HostStatus_t
 HostStatus::getHostStatus(const char *name)
 {
-  HostStatRec *_status = 0;
-  time_t now           = time(0);
-  bool lookup          = false;
+  HostStatRec_t *_status;
+  int lookup = 0;
+  time_t now = time(0);
 
   // the hash table value pointer has the HostStatus_t value.
   ink_rwlock_rdlock(&host_status_rwlock);
-  {
-    auto it = hosts_statuses.find(name);
-    lookup  = it != hosts_statuses.end();
-    if (lookup) {
-      _status = it->second;
-    }
-  }
+  lookup = ink_hash_table_lookup(hosts_statuses, name, reinterpret_cast<void **>(&_status));
   ink_rwlock_unlock(&host_status_rwlock);
+  Debug("host_statuses", "name: %s, status: %d", name, static_cast<int>(_status->status));
 
   // if the host was marked down and it's down_time has elapsed, mark it up.
-  if (lookup && _status->status == HostStatus_t::HOST_STATUS_DOWN) {
-    unsigned int reasons = _status->reasons;
-    if ((_status->reasons & Reason::ACTIVE) && _status->active_down_time > 0) {
-      if ((_status->active_down_time + _status->active_marked_down) < now) {
-        Debug("host_statuses", "name: %s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", name, now,
-              _status->active_down_time, _status->active_marked_down, Reason::ACTIVE_REASON);
-        setHostStatus(name, HostStatus_t::HOST_STATUS_UP, 0, Reason::ACTIVE);
-        reasons ^= Reason::ACTIVE;
-      }
-    }
-    if ((_status->reasons & Reason::LOCAL) && _status->local_down_time > 0) {
-      if ((_status->local_down_time + _status->local_marked_down) < now) {
-        Debug("host_statuses", "name: %s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", name, now,
-              _status->local_down_time, _status->local_marked_down, Reason::LOCAL_REASON);
-        setHostStatus(name, HostStatus_t::HOST_STATUS_UP, 0, Reason::LOCAL);
-        reasons ^= Reason::LOCAL;
-      }
-    }
-    if ((_status->reasons & Reason::MANUAL) && _status->manual_down_time > 0) {
-      if ((_status->manual_down_time + _status->manual_marked_down) < now) {
-        Debug("host_statuses", "name: %s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", name, now,
-              _status->manual_down_time, _status->manual_marked_down, Reason::MANUAL_REASON);
-        setHostStatus(name, HostStatus_t::HOST_STATUS_UP, 0, Reason::MANUAL);
-        reasons ^= Reason::MANUAL;
-      }
-    }
-    if ((_status->reasons & Reason::SELF_DETECT) && _status->self_detect_down_time > 0) {
-      if ((_status->self_detect_down_time + _status->self_detect_marked_down) < now) {
-        Debug("host_statuses", "name: %s, now: %ld, down_time: %d, marked_down: %ld, reason: %s", name, now,
-              _status->self_detect_down_time, _status->self_detect_marked_down, Reason::SELF_DETECT_REASON);
-        setHostStatus(name, HostStatus_t::HOST_STATUS_UP, 0, Reason::SELF_DETECT);
-        reasons ^= Reason::SELF_DETECT;
-      }
-    }
-    if (reasons == 0) {
+  if (lookup == 1 && _status->status == HostStatus_t::HOST_STATUS_DOWN && _status->down_time > 0) {
+    if ((_status->down_time + _status->marked_down) < now) {
+      Debug("host_statuses", "name: %s, now: %ld, down_time: %d, marked_down: %ld", name, now, _status->down_time,
+            _status->marked_down);
+      setHostStatus(name, HostStatus_t::HOST_STATUS_UP, 0);
       return HostStatus_t::HOST_STATUS_UP;
-    } else {
-      return HostStatus_t::HOST_STATUS_DOWN;
     }
   }
-  // didn't find this host in host status db, create the record
-  if (!lookup) {
-    createHostStat(name);
-  }
-
-  return lookup ? static_cast<HostStatus_t>(_status->status) : HostStatus_t::HOST_STATUS_UP;
+  return lookup == 1 ? static_cast<HostStatus_t>(_status->status) : HostStatus_t::HOST_STATUS_INIT;
 }
 
 void
-HostStatus::createHostStat(const char *name, const char *data)
+HostStatus::createHostStat(const char *name)
 {
-  char buf[1024] = {0};
-  HostStatRec r;
-
-  std::string stat_name;
-  std::stringstream status_rec;
-  if (data != nullptr) {
-    HostStatRec h(data);
-    r = h;
-  }
-  status_rec << r;
-  getStatName(stat_name, name);
-
-  if (getHostStat(stat_name, buf, 1024) == REC_ERR_FAIL) {
-    RecRegisterStatString(RECT_PROCESS, stat_name.c_str(), const_cast<char *>(status_rec.str().c_str()), RECP_PERSISTENT);
-    Debug("host_statuses", "stat name: %s, data: %s", stat_name.c_str(), status_rec.str().c_str());
+  InkHashTableEntry *entry;
+  entry = ink_hash_table_lookup_entry(hosts_stats_ids, name);
+  if (entry == nullptr) {
+    RecRegisterRawStat(host_status_rsb, RECT_PROCESS, (stat_prefix + name).c_str(), RECD_INT, RECP_NON_PERSISTENT,
+                       (int)next_stat_id, RecRawStatSyncSum);
+    Debug("host_statuses", "name: %s, id: %d", name, next_stat_id);
+    ink_rwlock_wrlock(&host_statids_rwlock);
+    ink_hash_table_insert(hosts_stats_ids, name, reinterpret_cast<void *>(next_stat_id));
+    ink_rwlock_unlock(&host_statids_rwlock);
+    setHostStatus(name, HostStatus_t::HOST_STATUS_UP, 0);
+    next_stat_id++;
   }
 }
 
 int
-HostStatus::getHostStat(std::string &stat_name, char *buf, unsigned int buf_len)
+HostStatus::getHostStatId(const char *name)
 {
-  return RecGetRecordString(stat_name.c_str(), buf, buf_len, true);
+  int lookup   = 0;
+  intptr_t _id = -1;
+
+  ink_rwlock_rdlock(&host_statids_rwlock);
+  lookup = ink_hash_table_lookup(hosts_stats_ids, name, reinterpret_cast<void **>(&_id));
+  ink_rwlock_unlock(&host_statids_rwlock);
+  Debug("host_statuses", "name: %s, id: %d", name, static_cast<int>(_id));
+
+  return lookup == 1 ? static_cast<int>(_id) : -1;
 }
diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc
index 1d183b9..26fb015 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -1861,8 +1861,6 @@ main(int /* argc ATS_UNUSED */, const char **argv)
     RecProcessStart();
     initCacheControl();
     IpAllow::startup();
-    HostStatus::instance().loadHostStatusFromStats();
-    netProcessor.init_socks();
     ParentConfig::startup();
     HostStatus::instance();
 #ifdef SPLIT_DNS


Mime
View raw message