trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] 04/04: TS-4401 Override proxy.config.http.parent_proxy.total_connect_attempts
Date Fri, 06 May 2016 03:29:09 GMT
This is an automated email from the ASF dual-hosted git repository.

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

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

    TS-4401 Override proxy.config.http.parent_proxy.total_connect_attempts
---
 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                          | 19 +++++++++----------
 proxy/http/HttpTransact.cc                       |  2 +-
 8 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index f3c0595..36102da 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1067,6 +1067,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 c28f3ab..3720b19 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7959,6 +7959,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:
@@ -8600,6 +8604,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 c82d2d9..672748e 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -957,7 +957,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");
 
@@ -1230,7 +1230,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 9330fa6..3cd75f3 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -380,9 +380,9 @@ struct OverridableHttpConfigParams {
       transaction_no_activity_timeout_in(30), transaction_no_activity_timeout_out(30), transaction_active_timeout_out(0),
       websocket_active_timeout(3600), websocket_inactive_timeout(600), origin_max_connections(0),
origin_max_connections_queue(0),
       attach_server_session_to_client(0), connect_attempts_max_retries(0), connect_attempts_max_retries_dead_server(3),
-      connect_attempts_rr_retries(3), connect_attempts_timeout(30), post_connect_attempts_timeout(1800),
down_server_timeout(300),
-      client_abort_threshold(10), freshness_fuzz_time(240), freshness_fuzz_min_time(0), max_cache_open_read_retries(-1),
-      cache_open_read_retry_time(10), cache_generation_number(-1), max_cache_open_write_retries(1),
+      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), freshness_fuzz_min_time(0),
+      max_cache_open_read_retries(-1), cache_open_read_retry_time(10), cache_generation_number(-1),
max_cache_open_write_retries(1),
       background_fill_active_timeout(60), http_chunking_size(4096), flow_high_water_mark(0),
flow_low_water_mark(0),
       default_buffer_size_index(8), default_buffer_water_mark(32768), slow_log_threshold(0),
 
@@ -544,6 +544,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;
@@ -670,7 +671,6 @@ public:
   ////////////////////////////////////
   // origin server connect attempts //
   ////////////////////////////////////
-  MgmtInt parent_connect_attempts;
   MgmtInt per_parent_connect_attempts;
   MgmtInt parent_connect_timeout;
 
@@ -852,12 +852,11 @@ extern volatile int32_t icp_dynamic_enabled;
 /////////////////////////////////////////////////////////////
 inline HttpConfigParams::HttpConfigParams()
   : proxy_hostname(NULL), proxy_hostname_len(0), server_max_connections(0), origin_min_keep_alive_connections(0),
-    max_websocket_connections(-1), disable_ssl_parenting(0), enable_url_expandomatic(0),
-    no_dns_forward_to_parent(0), no_origin_server_dns(0), use_client_target_addr(0), use_client_source_port(0),
-    proxy_request_via_string(NULL), proxy_request_via_string_len(0), proxy_response_via_string(NULL),
-    proxy_response_via_string_len(0), url_expansions_string(NULL), url_expansions(NULL),
num_url_expansions(0),
-    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),
+    max_websocket_connections(-1), disable_ssl_parenting(0), enable_url_expandomatic(0),
no_dns_forward_to_parent(0),
+    no_origin_server_dns(0), use_client_target_addr(0), use_client_source_port(0), proxy_request_via_string(NULL),
+    proxy_request_via_string_len(0), proxy_response_via_string(NULL), proxy_response_via_string_len(0),
url_expansions_string(NULL),
+    url_expansions(NULL), num_url_expansions(0), session_auth_cache_keep_alive_enabled(1),
transaction_active_timeout_in(900),
+    accept_no_activity_timeout(120), per_parent_connect_attempts(2), parent_connect_timeout(30),
anonymize_other_header_list(NULL),
     enable_http_stats(1), icp_enabled(0), stale_icp_enabled(0), cache_vary_default_text(NULL),
cache_vary_default_images(NULL),
     cache_vary_default_other(NULL), cache_enable_default_vary_headers(0), cache_post_method(0),
connect_ports_string(NULL),
     connect_ports(NULL), push_method_enabled(0), referer_filter_enabled(0), referer_format_redirect(0),
strict_uri_parsing(0),
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index b46850c..9cdf1df 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3611,7 +3611,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" <commits@trafficserver.apache.org>.

Mime
View raw message