Permalink
Browse files

TS-1919 Backing this change out, since it's been -1'd.

git revert did not handle this nicely, since the trees have
diverged so much. Instead, I simply made 5.0.x identical to
current "master".
  • Loading branch information...
1 parent a44a12a commit db67432fce4bc324856c17038269f327a9128efa @zwoop zwoop committed Jan 3, 2014
View
@@ -1,8 +1,5 @@
-*- coding: utf-8 -*-
-Changes with Apache Traffic Server 5.0.0
-
- *) [TS-1919] Eliminate CacheLookupHttpConfig. This breaks cluster
- compatibility, so all cluster nodes should be upgraded simultaneously.
+Changes with Apache Traffic Server 4.2.0
*) [TS-2467] traffic_shell doesn't work with tcl 8.6.
Author: Ben Aitchison <ben@meh.net.nz>
@@ -63,8 +60,6 @@ Changes with Apache Traffic Server 5.0.0
*) [TS-2432] Fix a race in aio_err_callblk.
-Changes with Apache Traffic Server 4.2.0
-
*) [TS-2251] Simplify LogBuffer reference counting.
*) [TS-2190] Remove cache.log from the cachurl plugin.
View
@@ -3413,15 +3413,15 @@ ink_cache_init(ModuleVersion v)
//----------------------------------------------------------------------------
Action *
CacheProcessor::open_read(Continuation *cont, URL *url, bool cluster_cache_local, CacheHTTPHdr *request,
- void *context, time_t pin_in_cache, CacheFragType type)
+ CacheLookupHttpConfig *params, time_t pin_in_cache, CacheFragType type)
{
#ifdef CLUSTER_CACHE
if (cache_clustering_enabled > 0 && !cluster_cache_local) {
- return open_read_internal(CACHE_OPEN_READ_LONG, cont, (MIOBuffer *) 0, url, request, context,
- (CacheKey *) 0, pin_in_cache, type, (char *) 0, 0);
+ return open_read_internal(CACHE_OPEN_READ_LONG, cont, (MIOBuffer *) 0,
+ url, request, params, (CacheKey *) 0, pin_in_cache, type, (char *) 0, 0);
}
#endif
- return caches[type]->open_read(cont, url, request, context, type);
+ return caches[type]->open_read(cont, url, request, params, type);
}
View
@@ -90,7 +90,7 @@ Cache::open_read(Continuation * cont, CacheKey * key, CacheFragType type, char *
#ifdef HTTP_CACHE
Action *
Cache::open_read(Continuation * cont, CacheKey * key, CacheHTTPHdr * request,
- void * context, CacheFragType type, char *hostname, int host_len)
+ CacheLookupHttpConfig * params, CacheFragType type, char *hostname, int host_len)
{
if (!CacheProcessor::IsCacheReady(type)) {
@@ -116,7 +116,7 @@ Cache::open_read(Continuation * cont, CacheKey * key, CacheHTTPHdr * request,
CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
c->request.copy_shallow(request);
c->frag_type = CACHE_FRAG_TYPE_HTTP;
- c->context = context;
+ c->params = params;
c->od = od;
}
if (!lock) {
@@ -242,7 +242,7 @@ CacheVC::openReadChooseWriter(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSE
return -ECACHE_NO_DOC;
}
if (cache_config_select_alternate) {
- alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, static_cast<HttpConfigParams*>(context));
+ alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, params);
if (alternate_index < 0)
return -ECACHE_ALT_MISS;
} else
@@ -967,8 +967,7 @@ CacheVC::openReadVecWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */
dir_overwrite(&first_key, vol, &dir, &od->first_dir);
if (od->move_resident_alt)
dir_insert(&od->single_doc_key, vol, &od->single_doc_dir);
-
- int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, static_cast<HttpConfigParams*>(context));
+ int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, params);
vol->close_write(this);
if (alt_ndx >= 0) {
vector.clear();
@@ -1074,7 +1073,7 @@ CacheVC::openReadStartHead(int event, Event * e)
goto Ldone;
}
if (cache_config_select_alternate) {
- alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, static_cast<HttpConfigParams*>(context));
+ alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, params);
if (alternate_index < 0) {
err = ECACHE_ALT_MISS;
goto Ldone;
View
@@ -53,6 +53,7 @@
struct CacheVC;
#ifdef HTTP_CACHE
+class CacheLookupHttpConfig;
class URL;
class HTTPHdr;
class HTTPInfo;
@@ -106,10 +107,14 @@ struct CacheProcessor:public Processor
#ifdef HTTP_CACHE
Action *lookup(Continuation *cont, URL *url, bool cluster_cache_local, bool local_only = false,
CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
- inkcoreapi Action *open_read(Continuation *cont, URL *url, bool cluster_cache_local, CacheHTTPHdr *request,
- void *context, time_t pin_in_cache = (time_t) 0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
- Action *open_read_buffer(Continuation *cont, MIOBuffer *buf, URL *url, CacheHTTPHdr *request,
- void *context, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
+ inkcoreapi Action *open_read(Continuation *cont, URL *url,
+ bool cluster_cache_local,
+ CacheHTTPHdr *request,
+ CacheLookupHttpConfig *params,
+ time_t pin_in_cache = (time_t) 0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
+ Action *open_read_buffer(Continuation *cont, MIOBuffer *buf, URL *url,
+ CacheHTTPHdr *request,
+ CacheLookupHttpConfig *params, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
Action *open_write(Continuation *cont, int expected_size, URL *url, bool cluster_cache_local,
CacheHTTPHdr *request, CacheHTTPInfo *old_info,
time_t pin_in_cache = (time_t) 0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
@@ -119,7 +124,7 @@ struct CacheProcessor:public Processor
Action *remove(Continuation *cont, URL *url, bool cluster_cache_local, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
Action *open_read_internal(int, Continuation *, MIOBuffer *, CacheURL *,
- CacheHTTPHdr *, void *,
+ CacheHTTPHdr *, CacheLookupHttpConfig *,
CacheKey *, time_t, CacheFragType type, char *hostname, int host_len);
#endif
Action *link(Continuation *cont, CacheKey *from, CacheKey *to, bool cluster_cache_local,
@@ -424,7 +424,7 @@ struct CacheVC: public CacheVConnection
CacheHTTPInfo *info;
CacheHTTPInfoVector *write_vector;
#ifdef HTTP_CACHE
- void *context;
+ CacheLookupHttpConfig *params;
#endif
int header_len; // for communicating with agg_copy
int frag_len; // for communicating with agg_copy
@@ -1035,9 +1035,9 @@ struct Cache
Action *lookup(Continuation *cont, URL *url, CacheFragType type);
inkcoreapi Action *open_read(Continuation *cont, CacheKey *key,
CacheHTTPHdr *request,
- void *context, CacheFragType type, char *hostname, int host_len);
+ CacheLookupHttpConfig *params, CacheFragType type, char *hostname, int host_len);
Action *open_read(Continuation *cont, URL *url, CacheHTTPHdr *request,
- void *context, CacheFragType type);
+ CacheLookupHttpConfig *params, CacheFragType type);
Action *open_write(Continuation *cont, CacheKey *key,
CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t) 0,
CacheKey *key1 = NULL,
@@ -1069,13 +1069,14 @@ inkcoreapi extern Cache *caches[NUM_CACHE_FRAG_TYPES];
#ifdef HTTP_CACHE
TS_INLINE Action *
-Cache::open_read(Continuation *cont, CacheURL *url, CacheHTTPHdr *request, void *context, CacheFragType type)
+Cache::open_read(Continuation *cont, CacheURL *url, CacheHTTPHdr *request,
+ CacheLookupHttpConfig *params, CacheFragType type)
{
INK_MD5 md5;
int len;
url->MD5_get(&md5);
const char *hostname = url->host_get(&len);
- return open_read(cont, &md5, request, context, type, (char *) hostname, len);
+ return open_read(cont, &md5, request, params, type, (char *) hostname, len);
}
TS_INLINE void
@@ -1178,8 +1179,9 @@ CacheProcessor::open_read(Continuation *cont, CacheKey *key, bool cluster_cache_
{
#ifdef CLUSTER_CACHE
if (cache_clustering_enabled > 0 && !cluster_cache_local) {
- return open_read_internal(CACHE_OPEN_READ, cont, (MIOBuffer *) 0, (CacheURL *) 0, (CacheHTTPHdr *) 0,
- (void *) 0, key, 0, frag_type, hostname, host_len);
+ return open_read_internal(CACHE_OPEN_READ, cont, (MIOBuffer *) 0,
+ (CacheURL *) 0, (CacheHTTPHdr *) 0,
+ (CacheLookupHttpConfig *) 0, key, 0, frag_type, hostname, host_len);
}
#endif
return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
@@ -1191,8 +1193,9 @@ CacheProcessor::open_read_buffer(Continuation *cont, MIOBuffer *buf ATS_UNUSED,
{
#ifdef CLUSTER_CACHE
if (cache_clustering_enabled > 0) {
- return open_read_internal(CACHE_OPEN_READ_BUFFER, cont, buf, (CacheURL *) 0, (CacheHTTPHdr *) 0,
- (void*) 0, key, 0, frag_type, hostname, host_len);
+ return open_read_internal(CACHE_OPEN_READ_BUFFER, cont, buf,
+ (CacheURL *) 0, (CacheHTTPHdr *) 0,
+ (CacheLookupHttpConfig *) 0, key, 0, frag_type, hostname, host_len);
}
#endif
return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
@@ -1273,17 +1276,17 @@ CacheProcessor::lookup(Continuation *cont, URL *url, bool cluster_cache_local, b
}
TS_INLINE Action *
-CacheProcessor::open_read_buffer(Continuation *cont, MIOBuffer *buf, URL *url, CacheHTTPHdr *request,
- void *context, CacheFragType type)
+CacheProcessor::open_read_buffer(Continuation *cont, MIOBuffer *buf,
+ URL *url, CacheHTTPHdr *request, CacheLookupHttpConfig *params, CacheFragType type)
{
(void) buf;
#ifdef CLUSTER_CACHE
if (cache_clustering_enabled > 0) {
- return open_read_internal(CACHE_OPEN_READ_BUFFER_LONG, cont, buf, url, request, context, (CacheKey *) 0,
- 0, type, (char *) 0, 0);
+ return open_read_internal(CACHE_OPEN_READ_BUFFER_LONG, cont, buf, url,
+ request, params, (CacheKey *) 0, 0, type, (char *) 0, 0);
}
#endif
- return caches[type]->open_read(cont, url, request, context, type);
+ return caches[type]->open_read(cont, url, request, params, type);
}
TS_INLINE Action *
@@ -1305,9 +1308,13 @@ CacheProcessor::open_write_buffer(Continuation * cont, MIOBuffer * buf, URL * ur
#ifdef CLUSTER_CACHE
TS_INLINE Action *
-CacheProcessor::open_read_internal(int opcode, Continuation *cont, MIOBuffer *buf, CacheURL *url, CacheHTTPHdr *request,
- void *context, CacheKey *key, time_t pin_in_cache, CacheFragType frag_type, char *hostname,
- int host_len)
+CacheProcessor::open_read_internal(int opcode,
+ Continuation *cont, MIOBuffer *buf,
+ CacheURL *url,
+ CacheHTTPHdr *request,
+ CacheLookupHttpConfig *params,
+ CacheKey *key,
+ time_t pin_in_cache, CacheFragType frag_type, char *hostname, int host_len)
{
INK_MD5 url_md5;
if ((opcode == CACHE_OPEN_READ_LONG) || (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
@@ -1318,11 +1325,12 @@ CacheProcessor::open_read_internal(int opcode, Continuation *cont, MIOBuffer *bu
ClusterMachine *m = cluster_machine_at_depth(cache_hash(url_md5));
if (m) {
- return Cluster_read(m, opcode, cont, buf, url, request, key, pin_in_cache, frag_type, hostname, host_len);
+ return Cluster_read(m, opcode, cont, buf, url,
+ request, params, key, pin_in_cache, frag_type, hostname, host_len);
} else {
if ((opcode == CACHE_OPEN_READ_LONG)
|| (opcode == CACHE_OPEN_READ_BUFFER_LONG)) {
- return caches[frag_type]->open_read(cont, &url_md5, request, context, frag_type, hostname, host_len);
+ return caches[frag_type]->open_read(cont, &url_md5, request, params, frag_type, hostname, host_len);
} else {
return caches[frag_type]->open_read(cont, key, frag_type, hostname, host_len);
}
@@ -76,6 +76,7 @@ struct CacheTestSM : public RegressionSM {
MIOBuffer *buffer;
IOBufferReader *buffer_reader;
#ifdef HTTP_CACHE
+ CacheLookupHttpConfig params;
CacheHTTPInfo info;
char urlstr[1024];
#endif
@@ -1212,6 +1212,14 @@ cache_op_ClusterFunction(ClusterHandler * ch, void *data, int len)
moi_len -= res;
p += res;
ink_assert(moi_len > 0);
+ // Unmarshal CacheLookupHttpConfig
+ c->ic_params = new(CacheLookupHttpConfigAllocator.alloc())
+ CacheLookupHttpConfig();
+ res = c->ic_params->unmarshal(&c->ic_arena, (const char *) p, moi_len);
+ ink_assert(res > 0);
+
+ moi_len -= res;
+ p += res;
CacheKey key(msg->url_md5);
@@ -1231,10 +1239,9 @@ cache_op_ClusterFunction(ClusterHandler * ch, void *data, int len)
memcpy(c->ic_hostname->data(), hostname, host_len);
}
- c->http_config_params = HttpConfig::acquire();
Cache *call_cache = caches[c->frag_type];
Action *a = call_cache->open_read(c, &key, &c->ic_request,
- c->http_config_params,
+ c->ic_params,
c->frag_type, hostname, host_len);
// Get rid of purify warnings since 'c' can be freed by open_read.
if (a != ACTION_RESULT_DONE) {
@@ -1873,21 +1880,22 @@ struct retryDisposeOfDataBuffer:public Continuation
{
CacheContinuation *c;
- int handleRetryEvent(int event, Event * e) {
+ int handleRetryEvent(int event, Event * e)
+ {
if (CacheContinuation::handleDisposeEvent(event, c) == EVENT_DONE) {
delete this;
- return EVENT_DONE;
- } else {
+ return EVENT_DONE;
+ } else
+ {
e->schedule_in(HRTIME_MSECONDS(10));
return EVENT_CONT;
}
}
-
retryDisposeOfDataBuffer(CacheContinuation * cont)
- : Continuation(new_ProxyMutex()), c(cont) {
- SET_HANDLER((rtryDisOfDBufHandler) &retryDisposeOfDataBuffer::handleRetryEvent);
+: Continuation(new_ProxyMutex()), c(cont) {
+ SET_HANDLER((rtryDisOfDBufHandler)
+ & retryDisposeOfDataBuffer::handleRetryEvent);
}
-
};
//////////////////////////////////////////////////////////////////
@@ -30,7 +30,6 @@
#define __P_CLUSTERCACHEINTERNAL_H__
#include "P_ClusterCache.h"
#include "I_OneWayTunnel.h"
-#include "HttpConfig.h"
//
// Compilation Options
@@ -165,10 +164,10 @@ struct CacheContinuation:public Continuation
Arena ic_arena;
CacheHTTPHdr ic_request;
CacheHTTPHdr ic_response;
- HttpConfigParams *http_config_params;
+ CacheLookupHttpConfig *ic_params;
CacheHTTPInfo ic_old_info;
CacheHTTPInfo ic_new_info;
- Ptr<IOBufferData> ic_hostname;
+ Ptr<IOBufferData> ic_hostname;
int ic_hostname_len;
// debugging
@@ -247,11 +246,11 @@ struct CacheContinuation:public Continuation
if (cache_vc_info.valid()) {
cache_vc_info.destroy();
}
- if (http_config_params) {
- HttpConfig::release(http_config_params);
- http_config_params = 0;
+ // Deallocate unmarshaled data
+ if (ic_params) {
+ delete ic_params;
+ ic_params = 0;
}
-
if (ic_request.valid()) {
ic_request.clear();
}
@@ -312,7 +311,7 @@ CacheContinuation():
lookup_open_write_vc_event(0),
ic_arena(),
ic_request(),
- ic_response(), http_config_params(0), ic_old_info(), ic_new_info(), ic_hostname_len(0), cache_op_ClusterFunction(0) {
+ ic_response(), ic_params(0), ic_old_info(), ic_new_info(), ic_hostname_len(0), cache_op_ClusterFunction(0) {
token.clear();
SET_HANDLER((CacheContHandler) & CacheContinuation::remoteOpEvent);
}
@@ -59,10 +59,13 @@ Cluster_lookup(Continuation * cont, CacheKey * key, CacheFragType frag_type, cha
}
inline Action *
-Cluster_read(ClusterMachine * owner_machine, int opcode, Continuation * cont, MIOBuffer * buf, CacheURL * url,
- CacheHTTPHdr * request, CacheKey * key, time_t pin_in_cache, CacheFragType frag_type, char *hostname,
- int host_len)
+Cluster_read(ClusterMachine * owner_machine, int opcode,
+ Continuation * cont, MIOBuffer * buf,
+ CacheURL * url, CacheHTTPHdr * request,
+ CacheLookupHttpConfig * params, CacheKey * key,
+ time_t pin_in_cache, CacheFragType frag_type, char *hostname, int host_len)
{
+ (void) params;
if (clusterProcessor.disable_remote_cluster_ops(owner_machine)) {
Action a;
a = cont;
@@ -90,6 +93,7 @@ Cluster_read(ClusterMachine * owner_machine, int opcode, Continuation * cont, MI
url_hostname = url->host_get(&url_hlen);
len += request->m_heap->marshal_length();
+ len += params->marshal_length();
len += url_hlen;
if ((flen + len) > DEFAULT_MAX_BUFFER_SIZE) // Bound marshalled data
@@ -106,7 +110,10 @@ Cluster_read(ClusterMachine * owner_machine, int opcode, Continuation * cont, MI
}
data += res;
cur_len -= res;
-
+ if ((res = params->marshal(data, cur_len)) < 0)
+ goto err_exit;
+ data += res;
+ cur_len -= res;
memcpy(data, url_hostname, url_hlen);
CacheOpArgs_General readArgs;
Oops, something went wrong.

0 comments on commit db67432

Please sign in to comment.