You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ig...@apache.org on 2012/07/19 01:54:11 UTC
[2/2] git commit: TS-1339: Check for pread capability on VC before
range request.
TS-1339: Check for pread capability on VC before range request.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bbc08e35
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bbc08e35
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bbc08e35
Branch: refs/heads/3.2.x
Commit: bbc08e356305b4187ed02a2539e95d65b7a50349
Parents: fd26de3
Author: Alan M. Carroll <am...@network-geographics.com>
Authored: Mon Jul 16 19:56:25 2012 -0500
Committer: Igor Galić <i....@brainsware.org>
Committed: Wed Jul 18 16:47:31 2012 -0700
----------------------------------------------------------------------
iocore/cache/I_Cache.h | 5 +++++
iocore/cache/P_CacheInternal.h | 7 +++++++
iocore/cluster/ClusterVConnection.cc | 6 ++++++
iocore/cluster/P_ClusterCache.h | 1 +
proxy/http/HttpSM.cc | 6 +++---
5 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bbc08e35/iocore/cache/I_Cache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index dc50ae0..5225d98 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -176,6 +176,11 @@ struct CacheVConnection:public VConnection
virtual bool set_pin_in_cache(time_t t) = 0;
virtual time_t get_pin_in_cache() = 0;
virtual int64_t get_object_size() = 0;
+
+ /** Test if the VC can support pread.
+ @return @c true if @c do_io_pread will work, @c false if not.
+ */
+ virtual bool is_pread_capable() = 0;
CacheVConnection();
};
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bbc08e35/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 2dcee3e..fb5393f 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -356,6 +356,7 @@ struct CacheVC: public CacheVConnection
virtual void set_http_info(CacheHTTPInfo *info);
virtual void get_http_info(CacheHTTPInfo ** info);
#endif
+ virtual bool is_pread_capable();
virtual bool set_pin_in_cache(time_t time_pin);
virtual time_t get_pin_in_cache();
virtual bool set_disk_io_priority(int priority);
@@ -755,6 +756,12 @@ CacheVC::get_frag_table() {
return 0;
}
+TS_INLINE bool
+CacheVC::is_pread_capable() {
+ ink_debug_assert(od);
+ return od->vector.count() <= 1;
+}
+
TS_INLINE int
Vol::close_write(CacheVC *cont)
{
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bbc08e35/iocore/cluster/ClusterVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterVConnection.cc b/iocore/cluster/ClusterVConnection.cc
index 84dd223..1c40c5b 100644
--- a/iocore/cluster/ClusterVConnection.cc
+++ b/iocore/cluster/ClusterVConnection.cc
@@ -481,6 +481,12 @@ ClusterVConnection::get_object_size()
return alternate.object_size_get();
}
+bool
+ClusterVConnection::is_pread_capable()
+{
+ return false;
+}
+
void
ClusterVConnection::set_http_info(CacheHTTPInfo * d)
{
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bbc08e35/iocore/cluster/P_ClusterCache.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterCache.h b/iocore/cluster/P_ClusterCache.h
index 4fac3c0..9fc001f 100644
--- a/iocore/cluster/P_ClusterCache.h
+++ b/iocore/cluster/P_ClusterCache.h
@@ -581,6 +581,7 @@ struct ClusterVConnection: public ClusterVConnectionBase
virtual bool get_data(int id, void *data); // backward compatibility
virtual void get_http_info(CacheHTTPInfo **);
virtual int64_t get_object_size();
+ virtual bool is_pread_capable();
// For VC(s) established via the HTTP version of OPEN_WRITE, additional
// data for the VC is passed in a second message. This additional
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bbc08e35/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 1545de8..50df44c 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2286,7 +2286,7 @@ STATE_ENTER(&HttpSM:state_cache_open_write, event);
t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_SUCCESS;
break;
- case CACHE_EVENT_OPEN_WRITE_FAILED:
+ case CACHE_EVENT_OPEN_WRITE_FAILED:
// Failed on the write lock and retrying the vector
// for reading
t_state.cache_info.write_lock_state = HttpTransact::CACHE_WL_FAIL;
@@ -4086,11 +4086,11 @@ HttpSM::do_range_setup_if_necessary()
do_range_parse(field);
if (t_state.range_setup == HttpTransact::RANGE_REQUESTED &&
- t_state.num_range_fields > 1 &&
+ (t_state.num_range_fields > 1 || !cache_sm.cache_read_vc->is_pread_capable()) &&
api_hooks.get(TS_HTTP_RESPONSE_TRANSFORM_HOOK) == NULL
)
{
- Debug("http_trans", "Handling multiple Range: requests");
+ Debug("http_trans", "Unable to accelerate range request, fallback to transform");
content_type = t_state.cache_info.object_read->response_get()->value_get(MIME_FIELD_CONTENT_TYPE, MIME_LEN_CONTENT_TYPE, &field_content_type_len);
//create a Range: transform processor for requests of type Range: bytes=1-2,4-5,10-100 (eg. multiple ranges)
range_trans = transformProcessor.range_transform(mutex,