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 2015/05/21 03:38:30 UTC
[1/2] trafficserver git commit: TS-2080 Remove arbitrary 1 year max
age limit on the cache, use configuration option
Repository: trafficserver
Updated Branches:
refs/heads/master edc8fbc92 -> 1781a6815
TS-2080 Remove arbitrary 1 year max age limit on the cache, use configuration option
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bdca37f0
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bdca37f0
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bdca37f0
Branch: refs/heads/master
Commit: bdca37f0edef7a0b7e5043ea890528d09fcd77c2
Parents: edc8fbc
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue May 12 08:49:48 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed May 20 19:37:45 2015 -0600
----------------------------------------------------------------------
proxy/http/HttpTransact.cc | 14 +++++++-------
proxy/http/HttpTransact.h | 1 -
proxy/http/HttpTransactCache.cc | 7 ++++---
proxy/http/HttpTransactCache.h | 4 ++++
4 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdca37f0/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index a923d6e..1149d23 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7098,7 +7098,7 @@ HttpTransact::calculate_document_freshness_limit(State *s, HTTPHdr *response, ti
freshness_limit = (int)response->get_cooked_cc_max_age();
DebugTxn("http_match", "calculate_document_freshness_limit --- max_age set, freshness_limit = %d", freshness_limit);
}
- freshness_limit = min(max(0, freshness_limit), NUM_SECONDS_IN_ONE_YEAR);
+ freshness_limit = min(max(0, freshness_limit), (int)s->txn_conf->cache_guaranteed_max_lifetime);
} else {
date_set = last_modified_set = false;
@@ -7135,7 +7135,7 @@ HttpTransact::calculate_document_freshness_limit(State *s, HTTPHdr *response, ti
DebugTxn("http_match", "calculate_document_freshness_limit --- Expires: %" PRId64 ", Date: %" PRId64 ", freshness_limit = %d",
(int64_t)expires_value, (int64_t)date_value, freshness_limit);
- freshness_limit = min(max(0, freshness_limit), NUM_SECONDS_IN_ONE_YEAR);
+ freshness_limit = min(max(0, freshness_limit), (int)s->txn_conf->cache_guaranteed_max_lifetime);
} else {
last_modified_value = 0;
if (response->presence(MIME_PRESENCE_LAST_MODIFIED)) {
@@ -7172,7 +7172,7 @@ HttpTransact::calculate_document_freshness_limit(State *s, HTTPHdr *response, ti
// The freshness limit must always fall within the min and max guaranteed bounds.
min_freshness_bounds = max((MgmtInt)0, s->txn_conf->cache_guaranteed_min_lifetime);
- max_freshness_bounds = min((MgmtInt)NUM_SECONDS_IN_ONE_YEAR, s->txn_conf->cache_guaranteed_max_lifetime);
+ max_freshness_bounds = s->txn_conf->cache_guaranteed_max_lifetime;
// Heuristic freshness can be more strict.
if (*heuristic) {
@@ -7205,7 +7205,7 @@ HttpTransact::calculate_document_freshness_limit(State *s, HTTPHdr *response, ti
int
HttpTransact::calculate_freshness_fuzz(State *s, int fresh_limit)
{
- static double LOG_YEAR = log10((double)NUM_SECONDS_IN_ONE_YEAR);
+ static double LOG_YEAR = log10((double)s->txn_conf->cache_guaranteed_max_lifetime);
const uint32_t granularity = 1000;
int result = 0;
@@ -7308,7 +7308,7 @@ HttpTransact::what_is_document_freshness(State *s, HTTPHdr *client_request, HTTP
if (s->txn_conf->freshness_fuzz_time >= 0) {
fresh_limit = fresh_limit - calculate_freshness_fuzz(s, fresh_limit);
fresh_limit = max(0, fresh_limit);
- fresh_limit = min(NUM_SECONDS_IN_ONE_YEAR, fresh_limit);
+ fresh_limit = min((int)s->txn_conf->cache_guaranteed_max_lifetime, fresh_limit);
}
current_age = HttpTransactHeaders::calculate_document_age(s->request_sent_time, s->response_received_time, cached_obj_response,
@@ -7316,9 +7316,9 @@ HttpTransact::what_is_document_freshness(State *s, HTTPHdr *client_request, HTTP
// Overflow ?
if (current_age < 0)
- current_age = NUM_SECONDS_IN_ONE_YEAR; // TODO: Should we make a new "max age" define?
+ current_age = s->txn_conf->cache_guaranteed_max_lifetime;
else
- current_age = min((time_t)NUM_SECONDS_IN_ONE_YEAR, current_age);
+ current_age = min((time_t)s->txn_conf->cache_guaranteed_max_lifetime, current_age);
DebugTxn("http_match", "[what_is_document_freshness] fresh_limit: %d current_age: %" PRId64, fresh_limit, (int64_t)current_age);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdca37f0/proxy/http/HttpTransact.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index e27616c..fa64940 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -46,7 +46,6 @@
#include "congest/Congestion.h"
#define MAX_DNS_LOOKUPS 2
-#define NUM_SECONDS_IN_ONE_YEAR (31536000) // (365L * 24L * 3600L)
#define HTTP_RELEASE_ASSERT(X) ink_release_assert(X)
// #define ink_cluster_time(X) time(X)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdca37f0/proxy/http/HttpTransactCache.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactCache.cc b/proxy/http/HttpTransactCache.cc
index 7b3eebc..66a9583 100644
--- a/proxy/http/HttpTransactCache.cc
+++ b/proxy/http/HttpTransactCache.cc
@@ -168,7 +168,7 @@ int
HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPHdr *client_request,
CacheLookupHttpConfig *http_config_params)
{
- time_t current_age, best_age = NUM_SECONDS_IN_ONE_YEAR;
+ time_t current_age, best_age = CacheHighAgeWatermark;
time_t t_now = 0;
int best_index = -1;
float best_Q = -1.0;
@@ -218,8 +218,9 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPH
current_age = HttpTransactHeaders::calculate_document_age(obj->request_sent_time_get(), obj->response_received_time_get(),
cached_response, cached_response->get_date(), t_now);
// Overflow?
- if (current_age < 0)
- current_age = NUM_SECONDS_IN_ONE_YEAR; // TODO: Should we make a different define for "max cache age" ?
+ if (current_age < 0) {
+ current_age = CacheHighAgeWatermark;
+ }
} else {
current_age = (time_t)0;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdca37f0/proxy/http/HttpTransactCache.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactCache.h b/proxy/http/HttpTransactCache.h
index 610f012..bc3b680 100644
--- a/proxy/http/HttpTransactCache.h
+++ b/proxy/http/HttpTransactCache.h
@@ -33,6 +33,10 @@
#include "libts.h"
+// This is needed since txn_conf->cache_guaranteed_max_lifetime is currently not
+// readily available in the cache. ToDo: We should fix this with TS-1919
+static const time_t CacheHighAgeWatermark = UINT_MAX;
+
struct CacheHTTPInfoVector;
class CacheLookupHttpConfig
[2/2] trafficserver git commit: Added TS-2080
Posted by zw...@apache.org.
Added TS-2080
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1781a681
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1781a681
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1781a681
Branch: refs/heads/master
Commit: 1781a68153a578d8255a67ece6f0d069761b1a9b
Parents: bdca37f
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed May 20 17:48:37 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed May 20 19:37:46 2015 -0600
----------------------------------------------------------------------
CHANGES | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1781a681/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index c063efb..9d32077 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 6.0.0
+ *) [TS-2080] Remove arbitrary 1 year max age limit on the cache, use
+ the existing configuration option properly.
+
*) [TS-2151] Eliminate the Sparse class allocator, just use the normal one
for HttpSM.