You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/05/20 23:11:14 UTC

[trafficserver] 18/28: TS-4401 Override proxy.config.http.parent_proxy.total_connect_attempts

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

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

commit a3ace1e2d33a883ed6d24cb5c1420985b051fb28
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Sat Apr 30 16:16:32 2016 -0600

    TS-4401 Override proxy.config.http.parent_proxy.total_connect_attempts
    
    (cherry picked from commit d59ee2b9c827c50920741e465b5e966cec07fac5)
    
     Conflicts:
    	proxy/http/HttpConfig.h
---
 doc/admin-guide/files/records.config.en.rst      | 1 +
 lib/ts/apidefs.h.in                              | 1 +
 plugins/experimental/ts_lua/ts_lua_http_config.c | 2 ++
 proxy/InkAPI.cc                                  | 9 +++++++++
 proxy/InkAPITest.cc                              | 1 +
 proxy/http/HttpConfig.cc                         | 4 ++--
 proxy/http/HttpConfig.h                          | 4 ++--
 proxy/http/HttpTransact.cc                       | 2 +-
 8 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 1bb1bd0..0483a95 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1060,6 +1060,7 @@ Parent Proxy Configuration
 
 .. ts:cv:: CONFIG proxy.config.http.parent_proxy.total_connect_attempts INT 4
    :reloadable:
+   :overridable:
 
    The total number of connection attempts allowed to a parent cache before Traffic Server bypasses the parent or fails the request
    (depending on the ``go_direct`` option in the :file:`parent.config` file).
diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
index d4b94db..4fb0977 100644
--- a/lib/ts/apidefs.h.in
+++ b/lib/ts/apidefs.h.in
@@ -698,6 +698,7 @@ typedef enum {
   TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT,
   TS_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT,
   TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT,
+  TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS,
   TS_CONFIG_LAST_ENTRY
 } TSOverridableConfigKey;
 
diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c b/plugins/experimental/ts_lua/ts_lua_http_config.c
index aca39ce..031a2a3 100644
--- a/plugins/experimental/ts_lua/ts_lua_http_config.c
+++ b/plugins/experimental/ts_lua/ts_lua_http_config.c
@@ -117,6 +117,7 @@ typedef enum {
   TS_LUA_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT = TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT,
   TS_LUA_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT = TS_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT,
   TS_LUA_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT = TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT,
+  TS_LUA_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS = TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS,
   TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY,
 } TSLuaOverridableConfigKey;
 
@@ -226,6 +227,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT),
+  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY),
 };
 
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 3336449..2ccb59f 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7971,6 +7971,10 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
   case TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT:
     ret = &overridableHttpConfig->uncacheable_requests_bypass_parent;
     break;
+  case TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS:
+    typ = OVERRIDABLE_TYPE_INT;
+    ret = &overridableHttpConfig->parent_connect_attempts;
+    break;
   // This helps avoiding compiler warnings, yet detect unhandled enum members.
   case TS_CONFIG_NULL:
   case TS_CONFIG_LAST_ENTRY:
@@ -8612,6 +8616,11 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
         cnf = TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD;
       }
       break;
+    case 's':
+      if (!strncmp(name, "proxy.config.http.parent_proxy.total_connect_attempts", length)) {
+        cnf = TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS;
+      }
+      break;
     }
     break;
 
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index d3b5716..82cd9bb 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7354,6 +7354,7 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {
   "proxy.config.websocket.no_activity_timeout",
   "proxy.config.websocket.active_timeout",
   "proxy.config.http.uncacheable_requests_bypass_parent",
+  "proxy.config.http.parent_proxy.total_connect_attempts",
 };
 
 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 c599a9e..76cc96f 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -956,7 +956,7 @@ HttpConfig::startup()
   HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_rr_retries, "proxy.config.http.connect_attempts_rr_retries");
   HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_timeout, "proxy.config.http.connect_attempts_timeout");
   HttpEstablishStaticConfigLongLong(c.oride.post_connect_attempts_timeout, "proxy.config.http.post_connect_attempts_timeout");
-  HttpEstablishStaticConfigLongLong(c.parent_connect_attempts, "proxy.config.http.parent_proxy.total_connect_attempts");
+  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");
 
@@ -1229,7 +1229,7 @@ HttpConfig::reconfigure()
   params->oride.connect_attempts_rr_retries = m_master.oride.connect_attempts_rr_retries;
   params->oride.connect_attempts_timeout = m_master.oride.connect_attempts_timeout;
   params->oride.post_connect_attempts_timeout = m_master.oride.post_connect_attempts_timeout;
-  params->parent_connect_attempts = m_master.parent_connect_attempts;
+  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;
 
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 81d1efb..5da1e4c 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -433,6 +433,7 @@ struct OverridableHttpConfigParams {
       connect_attempts_rr_retries(3),
       connect_attempts_timeout(30),
       post_connect_attempts_timeout(1800),
+      parent_connect_attempts(4),
       down_server_timeout(300),
       client_abort_threshold(10),
       freshness_fuzz_time(240),
@@ -616,6 +617,7 @@ struct OverridableHttpConfigParams {
   MgmtInt connect_attempts_rr_retries;
   MgmtInt connect_attempts_timeout;
   MgmtInt post_connect_attempts_timeout;
+  MgmtInt parent_connect_attempts;
 
   MgmtInt down_server_timeout;
   MgmtInt client_abort_threshold;
@@ -742,7 +744,6 @@ public:
   ////////////////////////////////////
   // origin server connect attempts //
   ////////////////////////////////////
-  MgmtInt parent_connect_attempts;
   MgmtInt per_parent_connect_attempts;
   MgmtInt parent_connect_timeout;
 
@@ -942,7 +943,6 @@ inline HttpConfigParams::HttpConfigParams()
     session_auth_cache_keep_alive_enabled(1),
     transaction_active_timeout_in(900),
     accept_no_activity_timeout(120),
-    parent_connect_attempts(4),
     per_parent_connect_attempts(2),
     parent_connect_timeout(30),
     anonymize_other_header_list(NULL),
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 6de9c8d..51358b7 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3608,7 +3608,7 @@ HttpTransact::handle_response_from_parent(State *s)
           next_lookup = find_server_and_update_current_info(s);
         }
       }
-    } else if (s->current.attempts < s->http_config_param->parent_connect_attempts) {
+    } else if (s->current.attempts < s->txn_conf->parent_connect_attempts) {
       s->current.attempts++;
 
       // Are we done with this particular parent?

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