You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/02/28 19:57:26 UTC

[trafficserver] branch 7.1.x updated: TS-4747: make marking parent proxies down in hostdb configurable.

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/7.1.x by this push:
       new  9688447   TS-4747: make marking parent proxies down in hostdb configurable.
9688447 is described below

commit 96884479d1f97d73bfcd0fbeed472594beb1433e
Author: jrushf1239k <Jo...@cable.comcast.com>
AuthorDate: Fri Feb 17 16:34:33 2017 +0000

    TS-4747: make marking parent proxies down in hostdb configurable.
    
    (cherry picked from commit 2752c758fd480c1becd814f40ff53896d44b315b)
---
 doc/admin-guide/files/records.config.en.rst                      | 9 +++++++++
 doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst | 1 +
 lib/ts/apidefs.h.in                                              | 1 +
 mgmt/RecordsConfig.cc                                            | 2 ++
 plugins/experimental/ts_lua/ts_lua_http_config.c                 | 2 ++
 proxy/InkAPI.cc                                                  | 8 ++++++++
 proxy/InkAPITest.cc                                              | 1 +
 proxy/http/HttpConfig.cc                                         | 2 ++
 proxy/http/HttpConfig.h                                          | 2 ++
 proxy/http/HttpTransact.cc                                       | 6 +++++-
 10 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 6920ee1..1de2dca 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1253,6 +1253,15 @@ Parent Proxy Configuration
 
    See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.
 
+.. ts:cv:: CONFIG proxy.config.http.parent_proxy.mark_down_hostdb INT 0
+   :reloadable:
+   :overridable:
+
+   Enables (``1``) or disables (``0``) marking parent proxies down in hostdb when a connection
+   error is detected.  Normally parent selection manages parent proxies and will mark them as unavailable
+   as needed.  But when parents are defined in dns with multiple ip addresses, it may be useful to mark the
+   failing ip down in hostdb.  In this case you would enable these updates.
+
 .. ts:cv:: CONFIG proxy.config.http.forward.proxy_auth_to_parent INT 0
    :reloadable:
    :overridable:
diff --git a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
index d0bd6d8..3fce260 100644
--- a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
+++ b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
@@ -140,6 +140,7 @@ c:member:`TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS`                    :ts:cv:`prox
 c:member:`TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS`                    :ts:cv:`proxy.config.http.origin_max_connections`
 c:member:`TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE`              :ts:cv:`proxy.config.http.origin_max_connections_queue`
 c:member:`TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS`       :ts:cv:`proxy.config.http.parent_proxy.total_connect_attempts`
+c:member:`TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB`                  :ts:cv:`proxy.config.http.parent_proxy.mark_down_hostdb`
 c:member:`TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED`         :ts:cv:`proxy.config.http.post.check.content_length.enabled`
 c:member:`TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT`             :ts:cv:`proxy.config.http.post_connect_attempts_timeout`
 c:member:`TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY`               :ts:cv:`proxy.config.http.redirect_use_orig_cache_key`
diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
index dcf6d0e..d38acb6 100644
--- a/lib/ts/apidefs.h.in
+++ b/lib/ts/apidefs.h.in
@@ -745,6 +745,7 @@ typedef enum {
   TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
   TS_CONFIG_SSL_CERT_FILENAME,
   TS_CONFIG_SSL_CERT_FILEPATH,
+  TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
   TS_CONFIG_LAST_ENTRY
 } TSOverridableConfigKey;
 
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 84875a0..5fb8ab3 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -514,6 +514,8 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout", RECD_INT, "30", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.http.parent_proxy.mark_down_hostdb", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  ,
   {RECT_CONFIG, "proxy.config.http.forward.proxy_auth_to_parent", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
   ,
 
diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c b/plugins/experimental/ts_lua/ts_lua_http_config.c
index b3eedd3..591a88a 100644
--- a/plugins/experimental/ts_lua/ts_lua_http_config.c
+++ b/plugins/experimental/ts_lua/ts_lua_http_config.c
@@ -124,6 +124,7 @@ typedef enum {
   TS_LUA_CONFIG_HTTP_FORWARD_CONNECT_METHOD                   = TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
   TS_LUA_CONFIG_SSL_CERT_FILENAME                             = TS_CONFIG_SSL_CERT_FILENAME,
   TS_LUA_CONFIG_SSL_CERT_FILEPATH                             = TS_CONFIG_SSL_CERT_FILEPATH,
+  TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB                 = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
 } TSLuaOverridableConfigKey;
 
 typedef enum {
@@ -238,6 +239,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_FORWARD_CONNECT_METHOD),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILENAME),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_SSL_CERT_FILEPATH),
+  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY),
 };
 
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index aec0fd3..051f795 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -8161,6 +8161,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
     typ = OVERRIDABLE_TYPE_STRING;
     ret = &overridableHttpConfig->client_cert_filepath;
     break;
+  case TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB:
+    ret = &overridableHttpConfig->parent_failures_update_hostdb;
+    break;
   // This helps avoiding compiler warnings, yet detect unhandled enum members.
   case TS_CONFIG_NULL:
   case TS_CONFIG_LAST_ENTRY:
@@ -8780,6 +8783,11 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
 
   case 47:
     switch (name[length - 1]) {
+    case 'b':
+      if (!strncmp(name, "proxy.config.http.parent_proxy.mark_down_hostdb", length)) {
+        cnf = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB;
+      }
+      break;
     case 'd':
       if (!strncmp(name, "proxy.config.http.negative_revalidating_enabled", length)) {
         cnf = TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED;
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 6978c05..55c56d5 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7621,6 +7621,7 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
   "proxy.config.http.forward_connect_method",
   "proxy.config.ssl.client.cert.filename",
   "proxy.config.ssl.client.cert.path",
+  "proxy.config.http.parent_proxy.mark_down_hostdb",
 };
 
 REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 0ff5423..708a759 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -972,6 +972,7 @@ HttpConfig::startup()
   HttpEstablishStaticConfigLongLong(c.oride.parent_connect_attempts, "proxy.config.http.parent_proxy.total_connect_attempts");
   HttpEstablishStaticConfigLongLong(c.per_parent_connect_attempts, "proxy.config.http.parent_proxy.per_parent_connect_attempts");
   HttpEstablishStaticConfigLongLong(c.parent_connect_timeout, "proxy.config.http.parent_proxy.connect_attempts_timeout");
+  HttpEstablishStaticConfigByte(c.oride.parent_failures_update_hostdb, "proxy.config.http.parent_proxy.mark_down_hostdb");
 
   HttpEstablishStaticConfigLongLong(c.oride.sock_recv_buffer_size_out, "proxy.config.net.sock_recv_buffer_size_out");
   HttpEstablishStaticConfigLongLong(c.oride.sock_send_buffer_size_out, "proxy.config.net.sock_send_buffer_size_out");
@@ -1254,6 +1255,7 @@ HttpConfig::reconfigure()
   params->oride.parent_connect_attempts       = m_master.oride.parent_connect_attempts;
   params->per_parent_connect_attempts         = m_master.per_parent_connect_attempts;
   params->parent_connect_timeout              = m_master.parent_connect_timeout;
+  params->oride.parent_failures_update_hostdb = m_master.oride.parent_failures_update_hostdb;
 
   params->oride.sock_recv_buffer_size_out = m_master.oride.sock_recv_buffer_size_out;
   params->oride.sock_send_buffer_size_out = m_master.oride.sock_send_buffer_size_out;
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 479e9f4..b98199a 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -410,6 +410,7 @@ struct OverridableHttpConfigParams {
       flow_control_enabled(0),
       normalize_ae_gzip(0),
       srv_enabled(0),
+      parent_failures_update_hostdb(0),
       cache_open_write_fail_action(0),
       post_check_content_length_enabled(1),
       redirection_enabled(0),
@@ -563,6 +564,7 @@ struct OverridableHttpConfigParams {
   // hostdb/dns variables //
   //////////////////////////
   MgmtByte srv_enabled;
+  MgmtByte parent_failures_update_hostdb;
 
   MgmtByte cache_open_write_fail_action;
 
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 8309b07..4ac3c63 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3571,7 +3571,11 @@ HttpTransact::handle_response_from_parent(State *s)
       ink_assert(s->hdr_info.server_request.valid());
 
       s->current.server->connect_result = ENOTCONN;
-      s->state_machine->do_hostdb_update_if_necessary();
+      // only mark the parent down in hostdb if the configuration allows it,
+      // see proxy.config.http.parent_proxy.mark_down_hostdb in records.config.
+      if (s->txn_conf->parent_failures_update_hostdb) {
+        s->state_machine->do_hostdb_update_if_necessary();
+      }
 
       char addrbuf[INET6_ADDRSTRLEN];
       DebugTxn("http_trans", "[%d] failed to connect to parent %s", s->current.attempts,

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].