You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by su...@apache.org on 2020/01/02 18:48:15 UTC
[trafficserver] branch master updated: Add invalid config warning
when cache open write fail and read retry are inconsistent
This is an automated email from the ASF dual-hosted git repository.
sudheerv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 757ac78 Add invalid config warning when cache open write fail and read retry are inconsistent
757ac78 is described below
commit 757ac78146dfa4aca18a4508ced2b9544d070f64
Author: Sudheer Vinukonda <su...@apache.org>
AuthorDate: Mon Dec 23 19:05:40 2019 -0800
Add invalid config warning when cache open write fail and read retry
are inconsistent
---
proxy/http/HttpCacheSM.cc | 10 ++++++++--
proxy/http/HttpConfig.cc | 8 ++++++++
proxy/http/HttpConfig.h | 10 ++++++++++
proxy/http/HttpSM.cc | 8 ++++----
proxy/http/HttpTransact.cc | 2 +-
proxy/http/HttpTransact.h | 10 ----------
6 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/proxy/http/HttpCacheSM.cc b/proxy/http/HttpCacheSM.cc
index bea5264..8fbbb60 100644
--- a/proxy/http/HttpCacheSM.cc
+++ b/proxy/http/HttpCacheSM.cc
@@ -172,7 +172,7 @@ HttpCacheSM::state_cache_open_write(int event, void *data)
break;
case CACHE_EVENT_OPEN_WRITE_FAILED:
- if (master_sm->t_state.txn_conf->cache_open_write_fail_action == HttpTransact::CACHE_WL_FAIL_ACTION_READ_RETRY) {
+ if (master_sm->t_state.txn_conf->cache_open_write_fail_action == CACHE_WL_FAIL_ACTION_READ_RETRY) {
// fall back to open_read_tries
// Note that when CACHE_WL_FAIL_ACTION_READ_RETRY is configured, max_cache_open_write_retries
// is automatically ignored. Make sure to not disable max_cache_open_read_retries
@@ -181,6 +181,12 @@ HttpCacheSM::state_cache_open_write(int event, void *data)
if (open_write_tries <= master_sm->t_state.txn_conf->max_cache_open_write_retries) {
Debug("http_cache", "[%" PRId64 "] [state_cache_open_write] cache open write failure %d. read retry triggered",
master_sm->sm_id, open_write_tries);
+ if (master_sm->t_state.txn_conf->max_cache_open_read_retries <= 0) {
+ Debug("http_cache",
+ "[%" PRId64 "] [state_cache_open_write] invalid config, cache write fail set to"
+ " read retry, but, max_cache_open_read_retries is not enabled",
+ master_sm->sm_id);
+ }
open_read_tries = 0;
read_retry_on_write_fail = true;
// make sure it doesn't loop indefinitely
@@ -206,7 +212,7 @@ HttpCacheSM::state_cache_open_write(int event, void *data)
break;
case EVENT_INTERVAL:
- if (master_sm->t_state.txn_conf->cache_open_write_fail_action == HttpTransact::CACHE_WL_FAIL_ACTION_READ_RETRY) {
+ if (master_sm->t_state.txn_conf->cache_open_write_fail_action == CACHE_WL_FAIL_ACTION_READ_RETRY) {
Debug("http_cache",
"[%" PRId64 "] [state_cache_open_write] cache open write failure %d. "
"falling back to read retry...",
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 6ee3c46..1284be7 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1468,6 +1468,14 @@ HttpConfig::reconfigure()
params->keepalive_internal_vc = INT_TO_BOOL(m_master.keepalive_internal_vc);
params->oride.cache_open_write_fail_action = m_master.oride.cache_open_write_fail_action;
+ if (params->oride.cache_open_write_fail_action == CACHE_WL_FAIL_ACTION_READ_RETRY) {
+ if (params->oride.max_cache_open_read_retries <= 0 || params->oride.max_cache_open_write_retries <= 0) {
+ Warning("Invalid config, cache_open_write_fail_action (%d), max_cache_open_read_retries (%" PRIu64 "), "
+ "max_cache_open_write_retries (%" PRIu64 ")",
+ params->oride.cache_open_write_fail_action, params->oride.max_cache_open_read_retries,
+ params->oride.max_cache_open_write_retries);
+ }
+ }
params->oride.cache_when_to_revalidate = m_master.oride.cache_when_to_revalidate;
params->max_post_size = m_master.max_post_size;
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 1588883..11a815c 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -330,6 +330,16 @@ enum {
http_stat_count
};
+enum CacheOpenWriteFailAction_t {
+ CACHE_WL_FAIL_ACTION_DEFAULT = 0x00,
+ CACHE_WL_FAIL_ACTION_ERROR_ON_MISS = 0x01,
+ CACHE_WL_FAIL_ACTION_STALE_ON_REVALIDATE = 0x02,
+ CACHE_WL_FAIL_ACTION_ERROR_ON_MISS_STALE_ON_REVALIDATE = 0x03,
+ CACHE_WL_FAIL_ACTION_ERROR_ON_MISS_OR_REVALIDATE = 0x04,
+ CACHE_WL_FAIL_ACTION_READ_RETRY = 0x05,
+ TOTAL_CACHE_WL_FAIL_ACTION_TYPES
+};
+
extern RecRawStatBlock *http_rsb;
/* Stats should only be accessed using these macros */
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index cb76444..093ff53 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2438,17 +2438,17 @@ HttpSM::state_cache_open_write(int event, void *data)
// for reading
if (t_state.redirect_info.redirect_in_process) {
SMDebug("http_redirect", "[%" PRId64 "] CACHE_EVENT_OPEN_WRITE_FAILED during redirect follow", sm_id);
- t_state.cache_open_write_fail_action = HttpTransact::CACHE_WL_FAIL_ACTION_DEFAULT;
+ t_state.cache_open_write_fail_action = CACHE_WL_FAIL_ACTION_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_WL_FAIL_ACTION_DEFAULT) {
+ if (t_state.txn_conf->cache_open_write_fail_action == CACHE_WL_FAIL_ACTION_DEFAULT) {
t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_FAIL;
break;
} else {
t_state.cache_open_write_fail_action = t_state.txn_conf->cache_open_write_fail_action;
if (!t_state.cache_info.object_read ||
- (t_state.cache_open_write_fail_action == HttpTransact::CACHE_WL_FAIL_ACTION_ERROR_ON_MISS_OR_REVALIDATE)) {
+ (t_state.cache_open_write_fail_action == CACHE_WL_FAIL_ACTION_ERROR_ON_MISS_OR_REVALIDATE)) {
// cache miss, set wl_state to fail
SMDebug("http", "[%" PRId64 "] cache object read %p, cache_wl_fail_action %d", sm_id, t_state.cache_info.object_read,
t_state.cache_open_write_fail_action);
@@ -2463,7 +2463,7 @@ HttpSM::state_cache_open_write(int event, void *data)
t_state.cache_open_write_fail_action = t_state.txn_conf->cache_open_write_fail_action;
// Note that CACHE_LOOKUP_COMPLETE may be invoked more than once
// if CACHE_WL_FAIL_ACTION_READ_RETRY is configured
- ink_assert(t_state.cache_open_write_fail_action == HttpTransact::CACHE_WL_FAIL_ACTION_READ_RETRY);
+ ink_assert(t_state.cache_open_write_fail_action == CACHE_WL_FAIL_ACTION_READ_RETRY);
t_state.cache_lookup_result = HttpTransact::CACHE_LOOKUP_NONE;
t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_READ_RETRY;
break;
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 37728b2..773a0df 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3083,7 +3083,7 @@ HttpTransact::handle_cache_write_lock(State *s)
// Write failed and read retry triggered
// Clean up server_request and re-initiate
// Cache Lookup
- ink_assert(s->cache_open_write_fail_action == HttpTransact::CACHE_WL_FAIL_ACTION_READ_RETRY);
+ ink_assert(s->cache_open_write_fail_action == CACHE_WL_FAIL_ACTION_READ_RETRY);
s->cache_info.write_status = CACHE_WRITE_LOCK_MISS;
StateMachineAction_t next;
next = SM_ACTION_CACHE_LOOKUP;
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index d7abcfb..6e1e60c 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -246,16 +246,6 @@ public:
TOTAL_CACHE_ACTION_TYPES
};
- enum CacheOpenWriteFailAction_t {
- CACHE_WL_FAIL_ACTION_DEFAULT = 0x00,
- CACHE_WL_FAIL_ACTION_ERROR_ON_MISS = 0x01,
- CACHE_WL_FAIL_ACTION_STALE_ON_REVALIDATE = 0x02,
- CACHE_WL_FAIL_ACTION_ERROR_ON_MISS_STALE_ON_REVALIDATE = 0x03,
- CACHE_WL_FAIL_ACTION_ERROR_ON_MISS_OR_REVALIDATE = 0x04,
- CACHE_WL_FAIL_ACTION_READ_RETRY = 0x05,
- TOTAL_CACHE_WL_FAIL_ACTION_TYPES
- };
-
enum CacheWriteLock_t {
CACHE_WL_INIT,
CACHE_WL_SUCCESS,