Repository: trafficserver Updated Branches: refs/heads/master b2006b44f -> e381073bd
[TS-3835]: Make open_write_fail_action setting overridable. Also, do not apply the setting for 3xx redirect follow. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/e381073b Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e381073b Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e381073b Branch: refs/heads/master Commit: e381073bd1108b3324c6210ceff2f16f764f7d2e Parents: b2006b4 Author: Sudheer Vinukonda <[email protected]> Authored: Thu Aug 13 00:19:58 2015 +0000 Committer: Sudheer Vinukonda <[email protected]> Committed: Thu Aug 13 00:19:58 2015 +0000 ---------------------------------------------------------------------- proxy/InkAPI.cc | 8 ++++++++ proxy/http/HttpConfig.cc | 4 ++-- proxy/http/HttpConfig.h | 7 +++---- proxy/http/HttpSM.cc | 10 ++++++++-- 4 files changed, 21 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e381073b/proxy/InkAPI.cc ---------------------------------------------------------------------- diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index f634d52..4f84612 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -7891,6 +7891,10 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr typ = OVERRIDABLE_TYPE_INT; ret = &overridableHttpConfig->max_cache_open_read_retries; break; + case TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION: + typ = OVERRIDABLE_TYPE_INT; + ret = &overridableHttpConfig->cache_open_write_fail_action; + break; case TS_CONFIG_HTTP_CACHE_RANGE_WRITE: ret = &overridableHttpConfig->cache_range_write; break; @@ -8429,6 +8433,10 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf, if (0 == strncmp(name, "proxy.config.http.server_session_sharing.match", length)) cnf = TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH; break; + case 'n': + if (!strncmp(name, "proxy.config.http.cache.open_write_fail_action", length)) + cnf = TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION; + break; } break; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e381073b/proxy/http/HttpConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index b467f2f..e45739c 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -1046,7 +1046,7 @@ HttpConfig::startup() HttpEstablishStaticConfigByte(c.send_100_continue_response, "proxy.config.http.send_100_continue_response"); HttpEstablishStaticConfigByte(c.disallow_post_100_continue, "proxy.config.http.disallow_post_100_continue"); HttpEstablishStaticConfigByte(c.parser_allow_non_http, "proxy.config.http.parse.allow_non_http"); - HttpEstablishStaticConfigLongLong(c.cache_open_write_fail_action, "proxy.config.http.cache.open_write_fail_action"); + HttpEstablishStaticConfigLongLong(c.oride.cache_open_write_fail_action, "proxy.config.http.cache.open_write_fail_action"); HttpEstablishStaticConfigByte(c.oride.cache_when_to_revalidate, "proxy.config.http.cache.when_to_revalidate"); HttpEstablishStaticConfigByte(c.oride.cache_required_headers, "proxy.config.http.cache.required_headers"); @@ -1308,7 +1308,7 @@ HttpConfig::reconfigure() params->send_100_continue_response = INT_TO_BOOL(m_master.send_100_continue_response); params->disallow_post_100_continue = INT_TO_BOOL(m_master.disallow_post_100_continue); params->parser_allow_non_http = INT_TO_BOOL(m_master.parser_allow_non_http); - params->cache_open_write_fail_action = m_master.cache_open_write_fail_action; + params->oride.cache_open_write_fail_action = m_master.oride.cache_open_write_fail_action; params->oride.cache_when_to_revalidate = m_master.oride.cache_when_to_revalidate; params->max_post_size = m_master.max_post_size; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e381073b/proxy/http/HttpConfig.h ---------------------------------------------------------------------- diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index 1722f74..fbedf97 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -388,7 +388,7 @@ struct OverridableHttpConfigParams { // Strings / floats must come last body_factory_template_base(NULL), body_factory_template_base_len(0), proxy_response_server_string(NULL), proxy_response_server_string_len(0), global_user_agent_header(NULL), global_user_agent_header_size(0), - cache_heuristic_lm_factor(0.10), freshness_fuzz_prob(0.005), background_fill_threshold(0.5) + cache_heuristic_lm_factor(0.10), freshness_fuzz_prob(0.005), background_fill_threshold(0.5), cache_open_write_fail_action(0) { } @@ -576,6 +576,7 @@ struct OverridableHttpConfigParams { MgmtFloat cache_heuristic_lm_factor; MgmtFloat freshness_fuzz_prob; MgmtFloat background_fill_threshold; + MgmtInt cache_open_write_fail_action; }; @@ -745,7 +746,6 @@ public: MgmtByte send_100_continue_response; MgmtByte disallow_post_100_continue; MgmtByte parser_allow_non_http; - MgmtInt cache_open_write_fail_action; MgmtInt max_post_size; MgmtByte server_session_sharing_pool; @@ -857,8 +857,7 @@ inline HttpConfigParams::HttpConfigParams() cluster_time_delta(0), redirection_enabled(0), redirection_host_no_port(0), number_of_redirections(1), post_copy_size(2048), ignore_accept_mismatch(0), ignore_accept_language_mismatch(0), ignore_accept_encoding_mismatch(0), ignore_accept_charset_mismatch(0), send_100_continue_response(0), disallow_post_100_continue(0), parser_allow_non_http(1), - cache_open_write_fail_action(0), max_post_size(0), server_session_sharing_pool(TS_SERVER_SESSION_SHARING_POOL_THREAD), - synthetic_port(0) + max_post_size(0), server_session_sharing_pool(TS_SERVER_SESSION_SHARING_POOL_THREAD), synthetic_port(0) { } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e381073b/proxy/http/HttpSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 156e696..40a86d1 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -2370,11 +2370,17 @@ HttpSM::state_cache_open_write(int event, void *data) case CACHE_EVENT_OPEN_WRITE_FAILED: // Failed on the write lock and retrying the vector // for reading - if (t_state.http_config_param->cache_open_write_fail_action == HttpTransact::CACHE_OPEN_WRITE_FAIL_DEFAULT) { + if (t_state.redirect_info.redirect_in_process) { + DebugSM("http_redirect", "[%" PRId64 "] CACHE_EVENT_OPEN_WRITE_FAILED during redirect follow", sm_id); + t_state.cache_open_write_fail_action = HttpTransact::CACHE_OPEN_WRITE_FAIL_DEFAULT; + t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_FAIL; + break; + } + if (t_state.txn_conf->cache_open_write_fail_action == HttpTransact::CACHE_OPEN_WRITE_FAIL_DEFAULT) { t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_FAIL; break; } else { - t_state.cache_open_write_fail_action = t_state.http_config_param->cache_open_write_fail_action; + t_state.cache_open_write_fail_action = t_state.txn_conf->cache_open_write_fail_action; if (!t_state.cache_info.object_read) { // cache miss, set wl_state to fail t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_FAIL;
