You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2015/08/27 19:31:14 UTC

[7/9] trafficserver git commit: [TS-3622]: Add a bound to read_while_writer retries with a config setting

[TS-3622]: Add a bound to read_while_writer retries with a config setting

(cherry picked from commit 1f1334530fe66feea9e4896cebf58d83ef10ff3e)


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/2538a969
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/2538a969
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/2538a969

Branch: refs/heads/5.3.x
Commit: 2538a969943e76b0680c45e27b76a2fb912e3a7d
Parents: 1f0a227
Author: Sudheer Vinukonda <su...@yahoo-inc.com>
Authored: Wed May 20 19:18:36 2015 +0000
Committer: Phil Sorber <so...@apache.org>
Committed: Thu Aug 27 11:21:18 2015 -0600

----------------------------------------------------------------------
 iocore/cache/Cache.cc          | 4 ++++
 iocore/cache/CacheRead.cc      | 3 ++-
 iocore/cache/P_CacheInternal.h | 1 +
 mgmt/RecordsConfig.cc          | 2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2538a969/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 88c86e2..2879e82 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -78,6 +78,7 @@ int cache_config_enable_checksum = 0;
 int cache_config_alt_rewrite_max_size = 4096;
 int cache_config_read_while_writer = 0;
 int cache_config_mutex_retry_delay = 2;
+int cache_config_read_while_writer_max_retries = 10;
 #ifdef HTTP_CACHE
 static int enable_cache_empty_http_doc = 0;
 /// Fix up a specific known problem with the 4.2.0 release.
@@ -3522,6 +3523,9 @@ ink_cache_init(ModuleVersion v)
   REC_EstablishStaticConfigInt32(cache_config_mutex_retry_delay, "proxy.config.cache.mutex_retry_delay");
   Debug("cache_init", "proxy.config.cache.mutex_retry_delay = %dms", cache_config_mutex_retry_delay);
 
+  REC_EstablishStaticConfigInt32(cache_config_read_while_writer_max_retries, "proxy.config.cache.read_while_writer.max_retries");
+  Debug("cache_init", "proxy.config.cache.read_while_writer.max_retries = %d", cache_config_read_while_writer_max_retries);
+
   REC_EstablishStaticConfigInt32(cache_config_hit_evacuate_percent, "proxy.config.cache.hit_evacuate_percent");
   Debug("cache_init", "proxy.config.cache.hit_evacuate_percent = %d", cache_config_hit_evacuate_percent);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2538a969/iocore/cache/CacheRead.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 4ba02f4..27379de 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -364,7 +364,8 @@ CacheVC::openReadFromWriter(int event, Event *e)
   // allow reading from unclosed writer for http requests only.
   ink_assert(frag_type == CACHE_FRAG_TYPE_HTTP || write_vc->closed);
   if (!write_vc->closed && !write_vc->fragment) {
-    if (!cache_config_read_while_writer || frag_type != CACHE_FRAG_TYPE_HTTP) {
+    if (!cache_config_read_while_writer || frag_type != CACHE_FRAG_TYPE_HTTP ||
+        writer_lock_retry >= cache_config_read_while_writer_max_retries) {
       MUTEX_RELEASE(lock);
       return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, (Event *)-err);
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2538a969/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 3d95778..d06c8d3 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -226,6 +226,7 @@ extern int cache_config_hit_evacuate_size_limit;
 extern int cache_config_force_sector_size;
 extern int cache_config_target_fragment_size;
 extern int cache_config_mutex_retry_delay;
+extern int cache_config_read_while_writer_max_retries;
 #if TS_USE_INTERIM_CACHE == 1
 extern int good_interim_disks;
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2538a969/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index d237508..f520f4a 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -952,6 +952,8 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.cache.mutex_retry_delay", RECD_INT, "2", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.cache.read_while_writer.max_retries", RECD_INT, "10", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
 
   //##############################################################################
   //#